From 45679bc5e4364c1c9816f419da392083eb05838b Mon Sep 17 00:00:00 2001 From: chenlan <18339827479@163.com> Date: Mon, 21 Jul 2025 15:09:06 +0800 Subject: [PATCH] =?UTF-8?q?crud=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/RoleController.php | 185 ++++++++++-------- app/admin/service/CorpService.php | 61 ++---- app/admin/service/RoleService.php | 31 +++ app/common/model/Corp.php | 12 +- app/common/service/BasicDataService.php | 2 +- app/common/service/RoleService.php | 55 ------ app/common/traits/RequestTrait.php | 38 ++++ .../traits/crud/CrudControllerTrait.php | 64 ++++-- app/common/traits/crud/CrudServiceTrait.php | 24 ++- app/common/validate/CorpValidate.php | 35 ++++ app/common/validate/RoleValidate.php | 4 +- app/middleware/AuthCheck.php | 56 +----- app/middleware/BasicData.php | 12 +- config/middleware.php | 1 + config/route.php | 16 +- 15 files changed, 318 insertions(+), 278 deletions(-) create mode 100644 app/admin/service/RoleService.php delete mode 100644 app/common/service/RoleService.php create mode 100644 app/common/traits/RequestTrait.php create mode 100644 app/common/validate/CorpValidate.php diff --git a/app/admin/controller/RoleController.php b/app/admin/controller/RoleController.php index 59ccb54..691e070 100644 --- a/app/admin/controller/RoleController.php +++ b/app/admin/controller/RoleController.php @@ -2,97 +2,116 @@ namespace app\admin\controller; -use app\common\validate\RoleValidate; -use app\common\service\RoleService; -use support\Request; +use app\common\controller\BaseController; +use app\admin\service\RoleService; +use app\common\traits\crud\CrudControllerTrait; -class RoleController extends \app\common\controller\BaseController +class RoleController extends BaseController { - /** - * 获取角色列表 - */ - public function list(Request $request) + + use CrudControllerTrait; + + protected $service; + + public function __construct() { - try { - $params = $request->all(); - $result = (new RoleService())->getRoleList($params); - // 定义后处理器 - $postProcessor = function($formattedData) { - if (isset($formattedData['created_at'])) - $formattedData['created_at'] = date('Y-m-d H:i:s', $formattedData['created_at']); - if (isset($formattedData['updated_at'])) - $formattedData['updated_at'] = date('Y-m-d H:i:s', $formattedData['updated_at']); - return $formattedData; - }; - return $this->success($this->transformData($result, $postProcessor), '角色列表获取成功'); - } catch (\Throwable $e) { - return $this->error($e->getMessage()); - } + $this->service = new RoleService(); } - /** - * 获取角色详情 - */ - public function detail(Request $request) + protected function indexFormat($data) { - try { - $roleId = $request->get('role_id'); - if (!$roleId) { - return $this->error('缺少角色ID', 422); - } - $result = (new RoleService())->getRoleDetail($roleId); - return $this->success($result, '角色详情获取成功'); - } catch (\Throwable $e) { - return $this->error($e->getMessage()); - } + if (isset($data['created_at'])) + $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']); + if (isset($data['updated_at'])) + $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']); + return $data; } - /** - * 增加角色 - */ - public function create(Request $request) - { - try { - $data = $this->validate(new RoleValidate(), $request->post(), 'role_create'); - $result = (new RoleService())->createRole($data); - return $this->success($result, '角色创建成功'); - } catch (\think\exception\ValidateException $e) { - return $this->error($e->getError(), 422); - } catch (\Throwable $e) { - return $this->error($e->getMessage()); - } - } + // /** + // * 获取角色列表 + // */ + // public function list(Request $request) + // { + // try { + // $params = $request->all(); + // $result = (new RoleService())->getRoleList($params); + // // 定义后处理器 + // $postProcessor = function($formattedData) { + // if (isset($formattedData['created_at'])) + // $formattedData['created_at'] = date('Y-m-d H:i:s', $formattedData['created_at']); + // if (isset($formattedData['updated_at'])) + // $formattedData['updated_at'] = date('Y-m-d H:i:s', $formattedData['updated_at']); + // return $formattedData; + // }; + // return $this->success($this->transformData($result, $postProcessor), '角色列表获取成功'); + // } catch (\Throwable $e) { + // return $this->error($e->getMessage()); + // } + // } - /** - * 修改角色 - */ - public function update(Request $request) - { - try { - $data = $this->validate(new RoleValidate(), $request->post(), 'role_update'); - $result = (new RoleService())->updateRole($data); - return $this->success($result, '角色更新成功'); - } catch (\think\exception\ValidateException $e) { - return $this->error($e->getError(), 422); - } catch (\Throwable $e) { - return $this->error($e->getMessage()); - } - } + // /** + // * 获取角色详情 + // */ + // public function detail(Request $request) + // { + // try { + // $roleId = $request->get('role_id'); + // if (!$roleId) { + // return $this->error('缺少角色ID', 422); + // } + // $result = (new RoleService())->getRoleDetail($roleId); + // return $this->success($result, '角色详情获取成功'); + // } catch (\Throwable $e) { + // return $this->error($e->getMessage()); + // } + // } - /** - * 删除角色 - */ - public function delete(Request $request) - { - try { - $roleId = $request->get('role_id'); - if (!$roleId) { - return $this->error('缺少角色ID', 422); - } - (new RoleService())->deleteRole($roleId); - return $this->success([], '角色删除成功'); - } catch (\Throwable $e) { - return $this->error($e->getMessage()); - } - } + // /** + // * 增加角色 + // */ + // public function create(Request $request) + // { + // try { + // $data = $this->validate(new RoleValidate(), $request->post(), 'role_create'); + // $result = (new RoleService())->createRole($data); + // return $this->success($result, '角色创建成功'); + // } catch (\think\exception\ValidateException $e) { + // return $this->error($e->getError(), 422); + // } catch (\Throwable $e) { + // return $this->error($e->getMessage()); + // } + // } + + // /** + // * 修改角色 + // */ + // public function update(Request $request) + // { + // try { + // $data = $this->validate(new RoleValidate(), $request->post(), 'role_update'); + // $result = (new RoleService())->updateRole($data); + // return $this->success($result, '角色更新成功'); + // } catch (\think\exception\ValidateException $e) { + // return $this->error($e->getError(), 422); + // } catch (\Throwable $e) { + // return $this->error($e->getMessage()); + // } + // } + + // /** + // * 删除角色 + // */ + // public function delete(Request $request) + // { + // try { + // $roleId = $request->get('role_id'); + // if (!$roleId) { + // return $this->error('缺少角色ID', 422); + // } + // (new RoleService())->deleteRole($roleId); + // return $this->success([], '角色删除成功'); + // } catch (\Throwable $e) { + // return $this->error($e->getMessage()); + // } + // } } diff --git a/app/admin/service/CorpService.php b/app/admin/service/CorpService.php index b1cc0bf..5767ea6 100644 --- a/app/admin/service/CorpService.php +++ b/app/admin/service/CorpService.php @@ -2,9 +2,9 @@ namespace app\admin\service; +use app\common\validate\CorpValidate; use app\common\traits\crud\CrudServiceTrait; use app\common\model\Corp; -use support\Request; class CorpService { @@ -15,6 +15,19 @@ class CorpService */ protected string $modelClass = Corp::class; + /** + * 验证器 + */ + protected $validator = CorpValidate::class; + + /** + * 获取验证器 + */ + public function getValidator() + { + return new $this->validator; + } + /** * 如果需要自定义,比如强制加一个 where['status']=1, @@ -27,33 +40,6 @@ class CorpService // return $config; // } - /** - * 如果需要自定义“哪些字段可筛选”或额外联表, - * 只需重写 buildQueryConfig: - */ - // protected function buildQueryConfig(Request $request): array - // { - // $config = parent::buildQueryConfig($request); - // // 强制只看 status=1 的记录 - // $config['where']['status'] = 1; - // // 自动 eager load company relation - // $config['with'][] = 'company'; - // return $config; - // } - - /** - * 复杂查询,覆盖 complexQuery 方法 - */ - // protected function complexQuery(array $params): array - // { - // return $this->logicComplex(function($q) use ($params) { - // // 自定义 join、where、select - // return $q->where('status', 1) - // ->orderBy('created_at','desc') - // ->paginate($params['limit'] ?? 15); - // })->toArray(); - // } - // /** // * 复杂查询示例: // * 只要在 URL 里添加 ?complex_query=1, @@ -100,23 +86,4 @@ class CorpService // $res['data'] = array_map(fn($i)=>[...], $res['data']); // return $res; // } - - // protected function afterServiceShow($item) - // { - // // 对详情对象处理 - // $item['extra']=123; - // return $item; - // } - - // afterServiceStore/Update/Destroy 同理 - - - // protected function afterServiceList(mixed $result): array - // { - // if ($result['records']) { - // $result['records'] = array_map(fn($i) => [...$i], $result['records']); - // } - - // return $result; - // } } \ No newline at end of file diff --git a/app/admin/service/RoleService.php b/app/admin/service/RoleService.php new file mode 100644 index 0000000..248bc3d --- /dev/null +++ b/app/admin/service/RoleService.php @@ -0,0 +1,31 @@ +validator; + } +} \ No newline at end of file diff --git a/app/common/model/Corp.php b/app/common/model/Corp.php index 52c160e..8820c80 100644 --- a/app/common/model/Corp.php +++ b/app/common/model/Corp.php @@ -46,4 +46,14 @@ class Corp extends Model public $timestamps = true; -} + protected $dateFormat = 'U'; + + + protected $fillable = [ + 'name', + 'abbr', + 'tenant_key', + 'sort', + 'status' + ]; +} \ No newline at end of file diff --git a/app/common/service/BasicDataService.php b/app/common/service/BasicDataService.php index e77a4e0..d5ff0ce 100644 --- a/app/common/service/BasicDataService.php +++ b/app/common/service/BasicDataService.php @@ -20,7 +20,7 @@ class BasicDataService public function checkAndCacheBaseParams($loginType, $systemCode, $corpAbbr) { if (!$loginType && !$systemCode && !$corpAbbr) { - throw new BusinessException(htmlpage()); + throw new BusinessException('header缺少必要参数'); } // 检查并缓存登录类型 diff --git a/app/common/service/RoleService.php b/app/common/service/RoleService.php deleted file mode 100644 index 24c14cf..0000000 --- a/app/common/service/RoleService.php +++ /dev/null @@ -1,55 +0,0 @@ -roleLogic = (new RoleLogic()); - } - - /** - * 获取角色列表 - */ - public function getRoleList(array $params) - { - return $this->roleLogic->getRoleList($params); - } - - /** - * 获取角色详情 - */ - public function getRoleDetail(int $roleId) - { - return $this->roleLogic->getRoleDetail($roleId); - } - - /** - * 创建角色 - */ - public function createRole(array $data) - { - return $this->roleLogic->createRole($data); - } - - /** - * 更新角色 - */ - public function updateRole(array $data) - { - return $this->roleLogic->updateRole($data); - } - - /** - * 删除角色 - */ - public function deleteRole(int $roleId) - { - return $this->roleLogic->deleteRole($roleId); - } -} diff --git a/app/common/traits/RequestTrait.php b/app/common/traits/RequestTrait.php new file mode 100644 index 0000000..8fefcc4 --- /dev/null +++ b/app/common/traits/RequestTrait.php @@ -0,0 +1,38 @@ +scene($scene); + } + // 执行数据验证 + if (!$validator->check($data)) { + // 验证失败,抛出业务异常,异常信息为验证器返回的错误信息 + throw new BusinessException($validator->getError()); + } + // 验证成功,返回原始数据 + return $data; + } + + +} \ No newline at end of file diff --git a/app/common/traits/crud/CrudControllerTrait.php b/app/common/traits/crud/CrudControllerTrait.php index 0fd4a0d..c5cdfdc 100644 --- a/app/common/traits/crud/CrudControllerTrait.php +++ b/app/common/traits/crud/CrudControllerTrait.php @@ -11,22 +11,26 @@ use support\Request; trait CrudControllerTrait { /** - * 获取资源列表(GET /resource) + * 获取列表 * * @param Request $request 请求对象 * @return mixed 返回分页数据及总数 */ public function index(Request $request) { - $raw = $this->service->serviceList($request); - $data = $this->transformData($raw, method_exists($this, 'indexFormat') - ? [$this, 'indexFormat'] - : null); - return $this->success($data); + try { + $raw = $this->service->serviceList($request); + $data = $this->transformData($raw, method_exists($this, 'indexFormat') + ? [$this, 'indexFormat'] + : null); + return $this->success($data); + } catch (\Exception $e) { + return $this->error($e->getMessage()); + } } /** - * 获取指定资源详情(GET /resource/{id}) + * 获取详情 * * @param Request $request 请求对象 * @param int|string $id 资源 ID @@ -34,47 +38,65 @@ trait CrudControllerTrait */ public function show(Request $request) { - $raw = $this->service->serviceShow($request); - $data = $this->transformData($raw, method_exists($this, 'showFormat') - ? [$this, 'showFormat'] - : null); - return $this->success($data); + try { + $raw = $this->service->serviceShow($request); + $data = $this->transformData($raw, method_exists($this, 'showFormat') + ? [$this, 'showFormat'] + : null); + return $this->success($data); + } catch (\Exception $e) { + return $this->error($e->getMessage()); + } } /** - * 创建新资源(POST /resource) + * 创建 * * @param Request $request 请求对象 * @return mixed 返回创建成功的数据或信息 */ public function store(Request $request) { - $res = $this->service->serviceStore($request); - return $this->success($res, '创建成功'); + try { + $data = $this->validate($this->service->getValidator(), $request->post(), 'create'); + $res = $this->service->serviceStore($request, $data); + return $this->success($res, '创建成功'); + } catch (\Exception $e) { + return $this->error($e->getMessage()); + } } /** - * 更新指定资源(PUT/PATCH /resource/{id}) + * 更新 * * @param Request $request 请求对象 * @return mixed 返回更新成功的数据或信息 */ public function update(Request $request) { - $res = $this->service->serviceUpdate($request); - return $this->success($res, '更新成功'); + try { + $data = $this->validate($this->service->getValidator(), $request->post(), 'update'); + $res = $this->service->serviceUpdate($request, $data); + return $this->success([], '更新成功'); + } catch (\Exception $e) { + return $this->error($e->getMessage()); + } } /** - * 删除指定资源(DELETE /resource/{id}) + * 删除 * * @param Request $request 请求对象 * @return mixed 返回删除操作结果 */ public function destroy(Request $request) { - $count = $this->service->serviceDestroy($request); - return $this->success([], "删除了 {$count} 条"); + try { + $count = $this->service->serviceDestroy($request); + return $this->success([], "成功删除了 {$count} 条"); + } catch (\Exception $e) { + return $this->error($e->getMessage()); + } } diff --git a/app/common/traits/crud/CrudServiceTrait.php b/app/common/traits/crud/CrudServiceTrait.php index 765042f..c042b5f 100644 --- a/app/common/traits/crud/CrudServiceTrait.php +++ b/app/common/traits/crud/CrudServiceTrait.php @@ -17,6 +17,14 @@ trait CrudServiceTrait /** 具体 Service 里定义:protected string $modelClass = YourModel::class; */ + /** + * 获取验证器 + */ + public function getValidator() + { + return $this->validator; + } + /** 分页列表 */ public function serviceList(Request $request) { @@ -52,18 +60,18 @@ trait CrudServiceTrait } /** 创建 */ - public function serviceStore(Request $request) + public function serviceStore(Request $request, array $data = []) { - $data = $request->post(); + // $data = $request->post(); $dl = $this->getDataLimitFromRequest($request); $created = $this->logicCreate($data, $dl); return $this->postProcess('Store', $created); } /** 更新 */ - public function serviceUpdate(Request $request) + public function serviceUpdate(Request $request, array $data = []) { - $data= $request->post(); + // $data= $request->post(); $config = $this->buildQueryConfig($request, 'update'); $updated = $this->logicUpdateBy($config, $data); return $this->postProcess('Update', $updated); @@ -100,13 +108,13 @@ trait CrudServiceTrait switch ($scene) { case 'default': $config['where']['status'] = 1; - $config['order']['sort'] = ['desc']; - $config['order']['id'] = ['desc']; + $config['order']['sort'] = 'desc'; + $config['order']['id'] = 'desc'; break; case 'index': $config['where']['status'] = 1; - $config['order']['sort'] = ['desc']; - $config['order']['id'] = ['desc']; + $config['order']['sort'] = 'desc'; + $config['order']['id'] = 'desc'; break; case 'show': $config['where']['id'] = $p['id']; diff --git a/app/common/validate/CorpValidate.php b/app/common/validate/CorpValidate.php new file mode 100644 index 0000000..5889ef9 --- /dev/null +++ b/app/common/validate/CorpValidate.php @@ -0,0 +1,35 @@ + 'require|number', + 'name' => 'require|max:255', + 'abbr' => 'require|in:hesu,xinyouhe,paika,simate,mbaf', + 'tenant_key' => 'string', + 'sort' => 'number', + 'status' => 'require|in:0,1' + ]; + + protected $message = [ + 'id.require' => 'ID不能为空', + 'id.number' => 'ID必须是数字', + 'name.require' => '企业名称不能为空', + 'name.max' => '企业名称长度不能超过255个字符', + 'abbr.require' => '企业缩写不能为空', + 'abbr.in' => '企业缩写必须是 hesu,xinyouhe,paika,simate,mbaf 中的一个', + 'tenant_key.string' => '飞书企业标识必须是字符串', + 'sort.number' => '排序值必须是数字', + 'status.require' => '状态不能为空', + 'status.in' => '状态必须是0或1' + ]; + + protected $scene = [ + 'create' => ['name', 'abbr', 'tenant_key', 'sort', 'status'], + 'update' => ['id', 'name', 'abbr', 'tenant_key', 'sort', 'status'] + ]; +} \ No newline at end of file diff --git a/app/common/validate/RoleValidate.php b/app/common/validate/RoleValidate.php index 330fae6..afd69cc 100644 --- a/app/common/validate/RoleValidate.php +++ b/app/common/validate/RoleValidate.php @@ -26,7 +26,7 @@ class RoleValidate extends Validate ]; protected $scene = [ - 'role_create' => ['system_id', 'name', 'desc', 'sort'], - 'role_update' => ['id', 'system_id', 'name', 'desc', 'sort', 'status'], + 'create' => ['system_id', 'name', 'desc', 'sort'], + 'update' => ['id', 'system_id', 'name', 'desc', 'sort', 'status'], ]; } diff --git a/app/middleware/AuthCheck.php b/app/middleware/AuthCheck.php index 3c504aa..a03e632 100644 --- a/app/middleware/AuthCheck.php +++ b/app/middleware/AuthCheck.php @@ -6,7 +6,6 @@ use ReflectionClass; use Webman\MiddlewareInterface; use Webman\Http\Response; use Webman\Http\Request; -use app\common\service\BasicDataService; class AuthCheck implements MiddlewareInterface { @@ -16,40 +15,11 @@ class AuthCheck implements MiddlewareInterface $properties = $controller->getDefaultProperties(); $noNeedLogin = $properties['noNeedLogin'] ?? []; $noNeedAuth = $properties['noNeedAuth'] ?? []; - $noNeedHeaderData = $properties['noNeedHeaderData'] ?? []; - - // header数据 - if (!in_array($request->action, $noNeedHeaderData)) { //如果需要header数据 - try { - $corpAbbr = $request->header('Fdesk-Corp-Abbr'); - $systemCode = $request->header('Fdesk-System-Code'); - $loginType = $request->header('Fdesk-Login-Type'); - $basicDataService = new BasicDataService(); - if ($basicDataService->checkAndCacheBaseParams($loginType, $systemCode, $corpAbbr)) { - $request->login_type = $loginType; - $request->system_code = $systemCode; - $request->corp_abbr = $corpAbbr; - $request->basic_data = [ - 'login_type' => $loginType, - 'system_code' => $systemCode, - 'corp_abbr' => $corpAbbr - ]; - } - return $handler($request); - } catch (\Throwable $th) { - throw $th; - $body = [ - 'status' => 'fail', - 'code' => 401, - 'message' => $th->getMessage(), - 'data' => [], - ]; - return response(json_encode($body, JSON_UNESCAPED_UNICODE), 401, ['Content-Type' => 'application/json']); - } - } - - // 不登陆&不鉴权 - if (!in_array($request->action, $noNeedLogin)) { //如果需要登陆&鉴权 + + if (in_array($request->action, $noNeedLogin)) { + // 白名单 + return $handler($request); + } else { try { $authHeader = $request->header('Fdesk-Auth-Token'); if (!$authHeader || !preg_match('/Bearer\s(\S+)/', $authHeader, $matches)) { @@ -75,22 +45,6 @@ class AuthCheck implements MiddlewareInterface } } - // 登陆&不鉴权 - // if (!in_array($request->action, $noNeedAuth)) { //如果需要登陆&不鉴权 - // try { - - // return $handler($request); - // } catch (\Throwable $e) { - // $body = [ - // 'status' => 'fail', - // 'code' => 401, - // 'message' => $e->getMessage(), - // 'data' => [], - // ]; - // return response(json_encode($body, JSON_UNESCAPED_UNICODE), 401, ['Content-Type' => 'application/json']); - // } - // } - return $handler($request); } } \ No newline at end of file diff --git a/app/middleware/BasicData.php b/app/middleware/BasicData.php index 472456e..9df57e7 100644 --- a/app/middleware/BasicData.php +++ b/app/middleware/BasicData.php @@ -12,9 +12,9 @@ class BasicData implements MiddlewareInterface public function process(Request $request, callable $handler): Response { $controller = new ReflectionClass($request->controller); - $noNeedHeader = $controller->getDefaultProperties()['noNeedHeader'] ?? []; + $noNeedHeaderData = $controller->getDefaultProperties()['noNeedHeaderData'] ?? []; - if (in_array($request->action, $noNeedHeader) || in_array($request->path(), config('whitelist.basi_cdata'))) { + if (in_array($request->action, $noNeedHeaderData)) { // 白名单 return $handler($request); } else { @@ -35,7 +35,13 @@ class BasicData implements MiddlewareInterface } return $handler($request); } catch (\Throwable $th) { - throw $th; + $body = [ + 'status' => 'fail', + 'code' => 403, + 'message' => $th->getMessage(), + 'data' => [], + ]; + return response(json_encode($body, JSON_UNESCAPED_UNICODE), 401, ['Content-Type' => 'application/json']); } } } diff --git a/config/middleware.php b/config/middleware.php index 6447d2c..ae0ad6e 100644 --- a/config/middleware.php +++ b/config/middleware.php @@ -16,6 +16,7 @@ return [ '' => [ \app\middleware\AccessControl::class, + \app\middleware\BasicData::class, \app\middleware\AuthCheck::class ] ]; \ No newline at end of file diff --git a/config/route.php b/config/route.php index e9cc611..700fb4b 100644 --- a/config/route.php +++ b/config/route.php @@ -28,6 +28,7 @@ use Webman\Route; // 调试 Route::any('/perm', [app\controller\IndexController::class, 'perm']); +// 公共 Route::group('/common', function () { Route::group('/auth', function () { Route::any('/login', [app\common\controller\AuthController::class, 'login']); @@ -50,20 +51,23 @@ Route::group('/common', function () { }); }); +// 后台管理 Route::group('/admin', function () { + // 角色 Route::group('/role', function () { - Route::any('/list', [app\admin\controller\RoleController::class, 'list']); - Route::any('/detail', [app\admin\controller\RoleController::class, 'detail']); - Route::any('/create', [app\admin\controller\RoleController::class, 'create']); + Route::any('/list', [app\admin\controller\RoleController::class, 'index']); + Route::any('/show', [app\admin\controller\RoleController::class, 'show']); + Route::any('/store', [app\admin\controller\RoleController::class, 'store']); Route::any('/update', [app\admin\controller\RoleController::class, 'update']); - Route::any('/delete', [app\admin\controller\RoleController::class, 'delete']); + Route::any('/destroy', [app\admin\controller\RoleController::class, 'destroy']); }); + // 公司 Route::group('/corp', function () { Route::any('/list', [app\admin\controller\CorpController::class, 'index']); Route::any('/show', [app\admin\controller\CorpController::class, 'show']); - // Route::any('/create', [app\admin\controller\CorpController::class, 'store']); + Route::any('/store', [app\admin\controller\CorpController::class, 'store']); Route::any('/update', [app\admin\controller\CorpController::class, 'update']); - // Route::any('/delete', [app\admin\controller\CorpController::class, 'destroy']); + Route::any('/destroy', [app\admin\controller\CorpController::class, 'destroy']); }); });