| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace App\Http\Requests;
- use App\Rules\AdultBirthDate;
- use App\ValueObjects\Cpf;
- use Illuminate\Foundation\Http\FormRequest;
- class StudentResponsibleRequest extends FormRequest
- {
- public function rules(): array
- {
- return [
- 'student_id' => 'required|exists:students,id',
- 'name' => 'required|string|max:255',
- 'birth_date' => ['required', 'date', new AdultBirthDate],
- 'cpf' => ['required', 'string', 'max:20', Cpf::rule()],
- 'gender' => 'nullable|string|in:male,female,other,no_preference',
- 'degree' => 'required|string|max:255',
- 'email' => 'required|email|max:255',
- 'phone' => 'required|string|max:20',
- 'street' => 'required|string|max:255',
- 'address_number' => 'nullable|string|max:20',
- 'postal_code' => 'required|string|max:10',
- 'neighborhood' => 'required|string|max:255',
- 'city_id' => 'required|exists:cities,id',
- 'state_id' => 'required|exists:states,id',
- 'complement' => 'nullable|string|max:255',
- 'notes' => 'nullable|string',
- ];
- }
- public function messages(): array
- {
- return [
- 'student_id.required' => 'O aluno é obrigatório.',
- 'student_id.exists' => 'Aluno não encontrado.',
- 'name.required' => 'O nome é obrigatório.',
- 'birth_date.required' => 'A data de nascimento é obrigatória.',
- 'cpf.required' => 'O CPF é obrigatório.',
- 'degree.required' => 'O grau de parentesco é obrigatório.',
- 'email.required' => 'O e-mail é obrigatório.',
- 'email.email' => 'Informe um e-mail válido.',
- 'phone.required' => 'O telefone é obrigatório.',
- 'street.required' => 'O endereço é obrigatório.',
- 'postal_code.required' => 'O CEP é obrigatório.',
- 'neighborhood.required' => 'O bairro é obrigatório.',
- 'city_id.required' => 'A cidade é obrigatória.',
- 'city_id.exists' => 'Cidade não encontrada.',
- 'state_id.required' => 'O estado é obrigatório.',
- 'state_id.exists' => 'Estado não encontrado.',
- ];
- }
- }
|