57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller\Admin;
|
|
|
|
use App\Middleware\Admin\JwtAuthMiddleware;
|
|
use App\Request\Admin\EmployeeRequest;
|
|
use App\Service\Admin\EmployeeService;
|
|
use Hyperf\HttpServer\Annotation\Controller;
|
|
use Hyperf\HttpServer\Annotation\Middlewares;
|
|
use Hyperf\HttpServer\Annotation\RequestMapping;
|
|
use Hyperf\Validation\Annotation\Scene;
|
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
|
|
#[Controller(prefix: "admin/employee")]
|
|
#[Middlewares([
|
|
JwtAuthMiddleware::class,
|
|
])]
|
|
class EmployeeController
|
|
{
|
|
#[RequestMapping(path: "add", methods: "POST")]
|
|
#[Scene(scene: "add")]
|
|
public function add(EmployeeRequest $request)
|
|
{
|
|
return (new EmployeeService)->add();
|
|
}
|
|
|
|
#[RequestMapping(path: "edit", methods: "POST")]
|
|
#[Scene(scene: "edit")]
|
|
public function edit(EmployeeRequest $request)
|
|
{
|
|
return (new EmployeeService)->edit();
|
|
}
|
|
|
|
#[RequestMapping(path: "del", methods: "POST")]
|
|
#[Scene(scene: "del")]
|
|
public function delete(EmployeeRequest $request)
|
|
{
|
|
return (new EmployeeService)->delete();
|
|
}
|
|
|
|
#[RequestMapping(path: "list", methods: "POST")]
|
|
#[Scene(scene: "list")]
|
|
public function list(EmployeeRequest $request)
|
|
{
|
|
return (new EmployeeService)->handle();
|
|
}
|
|
|
|
#[RequestMapping(path: "info", methods: "POST")]
|
|
#[Scene(scene: "info")]
|
|
public function info(EmployeeRequest $request)
|
|
{
|
|
return (new EmployeeService)->get();
|
|
}
|
|
}
|