StudentResponsibleRequest.php 2.3 KB

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