- Laravel Sanctum 기반 세션 인증 시스템 구축 - Service-First 아키텍처: AuthService 작성 - FormRequest 분리: LoginRequest 검증 - DaisyUI 기반 로그인 UI 구현 - 라우트 설정: /login, /logout, /dashboard - Tailwind CSS 4.x PostCSS 설정 - Vite 빌드 완료 Phase 1-1: 인증 시스템 개발 완료
54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Auth;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
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 [
|
|
'email' => ['required', 'email', 'max:255'],
|
|
'password' => ['required', 'string', 'min:8'],
|
|
'remember' => ['nullable', 'boolean'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom messages for validator errors.
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'email.required' => '이메일을 입력해주세요.',
|
|
'email.email' => '올바른 이메일 형식을 입력해주세요.',
|
|
'password.required' => '비밀번호를 입력해주세요.',
|
|
'password.min' => '비밀번호는 최소 8자 이상이어야 합니다.',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'email' => '이메일',
|
|
'password' => '비밀번호',
|
|
];
|
|
}
|
|
} |