first commit

This commit is contained in:
2026-04-15 20:16:52 +08:00
commit 8f45044411
1172 changed files with 329978 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
<?php
/**
* The file was created by Assimon.
*
* @author assimon<ashang@utf8.hk>
* @copyright assimon<ashang@utf8.hk>
* @link http://utf8.hk/
*/
namespace App\Admin\Actions\Post;
use Dcat\Admin\Grid\BatchAction;
use Illuminate\Http\Request;
class BatchRestore extends BatchAction
{
protected $title;
protected $model;
// 注意构造方法的参数必须要有默认值
public function __construct(string $model = null)
{
$this->title = admin_trans('dujiaoka.restore');
$this->model = $model;
}
public function handle(Request $request)
{
$model = $request->get('model');
foreach ((array) $this->getKey() as $key) {
$model::withTrashed()->findOrFail($key)->restore();
}
return $this->response()->success(admin_trans('dujiaoka.restored'))->refresh();
}
public function confirm()
{
return [admin_trans('dujiaoka.are_you_restore_sure')];
}
public function parameters()
{
return [
'model' => $this->model,
];
}
}
+52
View File
@@ -0,0 +1,52 @@
<?php
/**
* The file was created by Assimon.
*
* @author assimon<ashang@utf8.hk>
* @copyright assimon<ashang@utf8.hk>
* @link http://utf8.hk/
*/
namespace App\Admin\Actions\Post;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Http\Request;
class Restore extends RowAction
{
protected $title;
protected $model;
// 注意构造方法的参数必须要有默认值
public function __construct(string $model = null)
{
$this->title = admin_trans('dujiaoka.restore');
$this->model = $model;
}
public function handle(Request $request)
{
$key = $this->getKey();
$model = $request->get('model');
$model::withTrashed()->findOrFail($key)->restore();
return $this->response()->success(admin_trans('dujiaoka.restored'))->refresh();
}
public function confirm()
{
return [admin_trans('dujiaoka.are_you_restore_sure')];
}
public function parameters()
{
return [
'model' => $this->model,
];
}
}