This commit is contained in:
43
app/Controller/CompanyController.php
Normal file
43
app/Controller/CompanyController.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/5
|
||||
* Time: 下午6:04
|
||||
* Description:
|
||||
*
|
||||
* (c) ykxiao <yk_9001@hotmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Repository\Company\CompanyRepository;
|
||||
use App\Request\CompanyRequest;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\HttpMessage\Server\Response;
|
||||
use Hyperf\Validation\Annotation\Scene;
|
||||
|
||||
class CompanyController extends AbstractController
|
||||
{
|
||||
#[Inject]
|
||||
protected CompanyRepository $companyRepository;
|
||||
|
||||
/**
|
||||
* 添加公司.
|
||||
* @param CompanyRequest $request
|
||||
* @return Response
|
||||
*/
|
||||
#[Scene(scene: 'addCompany', argument: 'request')]
|
||||
public function addCompany(CompanyRequest $request): Response
|
||||
{
|
||||
$data = $request->all();
|
||||
|
||||
$this->companyRepository->add($data);
|
||||
|
||||
return $this->apiResponse->success();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user