58 lines
1.7 KiB
PHP
58 lines
1.7 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 文件功能:后台用户资料更新请求校验
|
||
|
|
*/
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Admin;
|
||
|
|
|
||
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 类功能:集中校验后台用户编辑弹窗提交的资料字段。
|
||
|
|
*/
|
||
|
|
class UpdateManagedUserRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* 方法功能:允许已通过路由中间件的后台用户继续执行校验。
|
||
|
|
*/
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 方法功能:返回后台用户编辑表单的校验规则。
|
||
|
|
*
|
||
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
||
|
|
*/
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'sex' => ['sometimes', 'integer', 'in:0,1,2'],
|
||
|
|
'exp_num' => ['sometimes', 'integer', 'min:0'],
|
||
|
|
'jjb' => ['sometimes', 'integer', 'min:0'],
|
||
|
|
'meili' => ['sometimes', 'integer', 'min:0'],
|
||
|
|
'qianming' => ['sometimes', 'nullable', 'string', 'max:255'],
|
||
|
|
'position_id' => ['sometimes', 'nullable', 'integer', 'exists:positions,id'],
|
||
|
|
'headface' => ['sometimes', 'string', 'max:50'],
|
||
|
|
'password' => ['nullable', 'string', 'min:6'],
|
||
|
|
'vip_level_id' => ['sometimes', 'nullable', 'integer', 'exists:vip_levels,id'],
|
||
|
|
'hy_time' => ['sometimes', 'nullable', 'date'],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 方法功能:返回后台用户编辑表单的中文错误提示。
|
||
|
|
*
|
||
|
|
* @return array<string, string>
|
||
|
|
*/
|
||
|
|
public function messages(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'position_id.exists' => '所选职务不存在,请重新选择。',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|