Files

43 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2025-07-11 15:21:00 +08:00
<?php
namespace app\admin\controller;
2025-07-21 15:09:06 +08:00
use app\common\controller\BaseController;
use app\admin\service\RoleService;
use app\common\traits\crud\CrudControllerTrait;
2025-08-14 20:08:57 +08:00
use support\Request;
2025-07-11 15:21:00 +08:00
2025-07-21 15:09:06 +08:00
class RoleController extends BaseController
2025-07-11 15:21:00 +08:00
{
2025-07-21 15:09:06 +08:00
use CrudControllerTrait;
2025-07-11 15:21:00 +08:00
2025-07-21 15:09:06 +08:00
protected $service;
2025-07-11 15:21:00 +08:00
2025-07-21 15:09:06 +08:00
public function __construct()
2025-07-11 15:21:00 +08:00
{
2025-07-21 15:09:06 +08:00
$this->service = new RoleService();
2025-07-11 15:21:00 +08:00
}
2025-07-21 15:09:06 +08:00
protected function indexFormat($data)
2025-07-11 15:21:00 +08:00
{
2025-07-21 15:09:06 +08:00
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;
2025-07-11 15:21:00 +08:00
}
2025-07-21 15:09:06 +08:00
2025-08-14 20:08:57 +08:00
public function menuResource(Request $request)
{
try {
// $data = $this->validate($this->service->getValidator(), $request->post(), 'allocation');
$data = $request->post();
$res = $this->service->menuResource($request, $data);
return $this->success($res);
} catch (\Throwable $e) {
return $this->error($e->getMessage());
}
}
}