Offline.php
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace App\Admin\Extensions\Actions;
use App\Admin\Rewrite\Actions\RowAction;
use App\Admin\Rewrite\Facades\Admin;
use Illuminate\Database\Eloquent\Model;
use App\Models\User\User;
class Offline extends RowAction
{
public $name = '下 架';
public function handle(Model $model)
{
// 设置置顶信息
$model->unshelved_status = config('constants.UNSHELVED');
$model->unshelved_opinion = '';
$model->unshelved_at = date("Y-m-d H:i:s");
$model->unshelved_by = 1;
$result = $model->save();
if ($result) {
return $this->response()->success(__('unshelved_succeeded'))->refresh();
} else {
return $this->response()->error(__('unshelved_failed'))->refresh();
}
}
public function dialog()
{
$settopConfirm = __('unshelve_confirm');
$options = [
'confirmButtonColor' =>'#f39c12',
'input' =>'textarea',
'inputPlaceholder' =>__('input').__('unshelved_opinion'),
'showLoaderOnConfirm' =>true,
];
$this->question(__('unshelve_confirm'), __('unshelved_opinion'), $options);
}
}