45 lines
1006 B
PHP
45 lines
1006 B
PHP
<?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 Exception;
|
|
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
|
|
* @throws Exception
|
|
*/
|
|
#[Scene(scene: 'addCompany', argument: 'request')]
|
|
public function addCompany(CompanyRequest $request): Response
|
|
{
|
|
$data = $request->all();
|
|
|
|
$this->companyRepository->add($data);
|
|
|
|
return $this->apiResponse->success();
|
|
}
|
|
} |