-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Slowlyo\OwlAdmin\Support\Apis; | ||
|
||
/** | ||
* 删除数据 | ||
*/ | ||
class DataDeleteApi extends AdminBaseApi | ||
{ | ||
public string $method = 'delete'; | ||
|
||
public function getTitle() | ||
{ | ||
return __('admin.api_templates.data_delete'); | ||
} | ||
|
||
public function handle() | ||
{ | ||
return $this->service()->delete(request($this->getArgs('primary_key', 'ids'))); | ||
} | ||
|
||
public function argsSchema() | ||
{ | ||
return [ | ||
amis()->SelectControl('model', __('admin.relationships.model')) | ||
->required() | ||
->menuTpl('${label} <span class="text-gray-300 pl-2">${table}</span>') | ||
->source('/dev_tools/relation/model_options') | ||
->searchable(), | ||
amis()->TextControl('primary_id', __('admin.code_generators.primary_key'))->value('ids'), | ||
]; | ||
} | ||
|
||
protected function service() | ||
{ | ||
$service = $this->blankService(); | ||
|
||
$service->setModelName($this->getArgs('model')); | ||
|
||
return $service; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Slowlyo\OwlAdmin\Support\Apis; | ||
|
||
/** | ||
* 数据更新 | ||
*/ | ||
class DataUpdateApi extends AdminBaseApi | ||
{ | ||
public string $method = 'put'; | ||
|
||
public function getTitle() | ||
{ | ||
return __('admin.api_templates.data_update'); | ||
} | ||
|
||
public function handle() | ||
{ | ||
return $this->service()->update(request($this->getArgs('primary_key', 'id')), request()->all()); | ||
} | ||
|
||
public function argsSchema() | ||
{ | ||
return [ | ||
amis()->SelectControl('model', __('admin.relationships.model')) | ||
->required() | ||
->menuTpl('${label} <span class="text-gray-300 pl-2">${table}</span>') | ||
->source('/dev_tools/relation/model_options') | ||
->searchable(), | ||
amis()->TextControl('primary_id', __('admin.code_generators.primary_key'))->value('id'), | ||
]; | ||
} | ||
|
||
protected function service() | ||
{ | ||
$service = $this->blankService(); | ||
|
||
$service->setModelName($this->getArgs('model')); | ||
|
||
return $service; | ||
} | ||
} |