123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace App\Http\Requests\Admin;
- use App\Models\User;
- use Illuminate\Foundation\Http\FormRequest;
- use Illuminate\Validation\Rules;
- class LoginRequest 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 [
- 'username' => ['required', 'string', 'lowercase', 'max:255'],
- 'password' => ['required']
- // 'password' => ['required', 'regex:/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d!$%@#£€*?&]{6,}$/']
- // 'password' => ['required', Rules\Password::defaults()]
- ];
- }
- public function messages(): array
- {
- return [
- 'username.required' => '请输入用户名',
- 'password.required' => '请输入密码',
- ];
- }
- }
|