This commit is contained in:
89
app/Request/FirstCompanyRequest.php
Normal file
89
app/Request/FirstCompanyRequest.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/5
|
||||
* Time: 下午9:28
|
||||
* 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\Request;
|
||||
|
||||
class FirstCompanyRequest extends AbstractRequest
|
||||
{
|
||||
public array $scenes = [
|
||||
'addFirstCompany' => [
|
||||
'domain',
|
||||
'name',
|
||||
'full_name',
|
||||
'company_type',
|
||||
'address',
|
||||
'logo',
|
||||
'owner', // 公司负责人
|
||||
'id_card', // 法人身份证
|
||||
'mobile',
|
||||
'org_code',
|
||||
'remark',
|
||||
'active_status',
|
||||
'activation_date',
|
||||
],
|
||||
];
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'integer',
|
||||
'name' => 'required|string|max:60',
|
||||
// 域名只能是英文、数字、下划线、短横线
|
||||
'domain' => 'required|string|max:100|regex:/^[a-zA-Z0-9_-]+$/',
|
||||
'full_name' => 'required|string|max:255',
|
||||
'company_type' => 'required|in:1,2',
|
||||
'address' => 'required|string|max:255',
|
||||
'logo' => 'string|max:255',
|
||||
'owner' => 'required|string|max:45',
|
||||
'id_card' => 'string|max:18',
|
||||
// 验证手机号,加正则验证
|
||||
'mobile' => 'required|string|max:11|regex:/^1[3-9]\d{9}$/',
|
||||
'org_code' => 'string|max:64',
|
||||
'remark' => 'string|max:255',
|
||||
'active_status' => 'required|integer|in:0,1',
|
||||
// 激活日期:不能小于当前时间
|
||||
'activation_date' => 'date|date_format:Y-m-d|after_or_equal:today',
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'id' => '公司ID',
|
||||
'name' => '公司名称',
|
||||
'domain' => '公司域名',
|
||||
'full_name' => '公司全称',
|
||||
'company_type' => '公司类型',
|
||||
'address' => '公司地址',
|
||||
'logo' => '公司logo',
|
||||
'owner' => '公司负责人',
|
||||
'id_card' => '法人身份证',
|
||||
'mobile' => '手机号码',
|
||||
'org_code' => '组织机构代码',
|
||||
'remark' => '备注',
|
||||
'active_status' => '激活状态',
|
||||
'activation_date' => '激活日期',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'domain.regex' => '只能是英文、数字、下划线、短横线',
|
||||
'mobile.regex' => '手机号码格式不正确',
|
||||
'activation_date.after_or_equal' => '激活日期不能小于当前时间',
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user