first
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Http\Controllers\Admin\Actions\Certification;
|
||||
|
||||
use Encore\Admin\Actions\RowAction;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Replicate extends RowAction
|
||||
{
|
||||
public $name = '复制配置';
|
||||
|
||||
public function handle(Model $model)
|
||||
{
|
||||
try {
|
||||
DB::transaction(function () use ($model) {
|
||||
$new = $model->replicate();
|
||||
|
||||
$new->status = 0;
|
||||
$new->save();
|
||||
});
|
||||
|
||||
return $this->response()->success('复制菜单完成')->refresh();
|
||||
} catch (\Exception $exception) {
|
||||
return $this->response()->error('复制菜单出错了')->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public function dialog()
|
||||
{
|
||||
$this->confirm('确定复制配置么?');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user