* * 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\Request; use App\Constants\ActiveStatusConst; use App\Constants\CompanyTypeConst; class CompanyRequest extends AbstractRequest { public array $scenes = [ 'addCompany' => [ 'id', 'company_type', 'name', 'status', ], ]; public function rules(): array { return [ 'id' => 'integer', 'company_type' => 'required|in:' . implode(',', array_column(CompanyTypeConst::getConstantsList(), 'value')), 'name' => 'required|string|max:128', 'status' => 'integer|in:0,1', ]; } public function attributes(): array { return [ 'id' => '公司ID', 'company_type' => '公司类型', 'name' => '公司名称', 'status' => '状态', ]; } }