2026-02-26 13:35:38 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 文件功能:用户修改个人资料请求验证器
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author ChatRoom Laravel
|
|
|
|
|
|
*
|
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
|
|
|
|
class UpdateProfileRequest extends FormRequest
|
|
|
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function rules(): array
|
|
|
|
|
|
{
|
|
|
|
|
|
return [
|
2026-02-26 22:57:30 +08:00
|
|
|
|
'sex' => ['required', 'in:0,1,2'],
|
2026-02-26 13:35:38 +08:00
|
|
|
|
'headface' => ['required', 'string', 'max:50'], // 比如存放 01.gif - 50.gif
|
|
|
|
|
|
'sign' => ['nullable', 'string', 'max:255'],
|
2026-02-26 22:50:35 +08:00
|
|
|
|
'email' => ['nullable', 'email', 'max:255'],
|
|
|
|
|
|
'question' => ['nullable', 'string', 'max:100'],
|
|
|
|
|
|
'answer' => ['nullable', 'string', 'max:100'],
|
2026-02-26 13:35:38 +08:00
|
|
|
|
];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function messages(): array
|
|
|
|
|
|
{
|
|
|
|
|
|
return [
|
2026-02-26 22:57:30 +08:00
|
|
|
|
'sex.in' => '性别选项无效(0=保密 1=男 2=女)。',
|
2026-02-26 13:35:38 +08:00
|
|
|
|
'headface.required' => '必须选择一个头像。',
|
|
|
|
|
|
];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|