first
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Http\Controllers\Admin\Actions\Certification;
|
||||
|
||||
use Encore\Admin\Actions\RowAction;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Modules\User\Models\UserCertificationConfig;
|
||||
|
||||
class ConfigPublish extends RowAction
|
||||
{
|
||||
public $name = '使用配置';
|
||||
|
||||
public function handle(Model $model)
|
||||
{
|
||||
UserCertificationConfig::where('id', '<>', $model->id)->update(['status' => 0]);
|
||||
$model->status = 1;
|
||||
$model->save();
|
||||
|
||||
return $this->response()->success('发布配置完成')->refresh();
|
||||
}
|
||||
|
||||
public function dialog()
|
||||
{
|
||||
$this->confirm('确定使用配置么?');
|
||||
}
|
||||
}
|
||||
@@ -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