StudentResponsibleRequest.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace App\Http\Requests;
  3. use App\ValueObjects\Cpf;
  4. use Illuminate\Foundation\Http\FormRequest;
  5. class StudentResponsibleRequest extends FormRequest
  6. {
  7. public function rules(): array
  8. {
  9. return [
  10. 'student_id' => 'required|exists:students,id',
  11. 'name' => 'required|string|max:255',
  12. 'birth_date' => 'required|date',
  13. 'cpf' => ['required', 'string', 'max:20', Cpf::rule()],
  14. 'gender' => 'nullable|string|in:male,female,other,no_preference',
  15. 'degree' => 'required|string|max:255',
  16. 'email' => 'required|email|max:255',
  17. 'phone' => 'required|string|max:20',
  18. 'street' => 'required|string|max:255',
  19. 'address_number' => 'nullable|string|max:20',
  20. 'postal_code' => 'required|string|max:10',
  21. 'neighborhood' => 'required|string|max:255',
  22. 'city_id' => 'required|exists:cities,id',
  23. 'state_id' => 'required|exists:states,id',
  24. 'complement' => 'nullable|string|max:255',
  25. 'notes' => 'nullable|string',
  26. ];
  27. }
  28. public function messages(): array
  29. {
  30. return [
  31. 'student_id.required' => 'O aluno é obrigatório.',
  32. 'student_id.exists' => 'Aluno não encontrado.',
  33. 'name.required' => 'O nome é obrigatório.',
  34. 'birth_date.required' => 'A data de nascimento é obrigatória.',
  35. 'cpf.required' => 'O CPF é obrigatório.',
  36. 'degree.required' => 'O grau de parentesco é obrigatório.',
  37. 'email.required' => 'O e-mail é obrigatório.',
  38. 'email.email' => 'Informe um e-mail válido.',
  39. 'phone.required' => 'O telefone é obrigatório.',
  40. 'street.required' => 'O endereço é obrigatório.',
  41. 'postal_code.required' => 'O CEP é obrigatório.',
  42. 'neighborhood.required' => 'O bairro é obrigatório.',
  43. 'city_id.required' => 'A cidade é obrigatória.',
  44. 'city_id.exists' => 'Cidade não encontrada.',
  45. 'state_id.required' => 'O estado é obrigatório.',
  46. 'state_id.exists' => 'Estado não encontrado.',
  47. ];
  48. }
  49. }