|
@@ -8,27 +8,45 @@ class StudentResponsibleRequest extends FormRequest
|
|
|
{
|
|
{
|
|
|
public function rules(): array
|
|
public function rules(): array
|
|
|
{
|
|
{
|
|
|
- $rules = [
|
|
|
|
|
- // Add your validation rules here
|
|
|
|
|
- //'field' => 'sometimes|string|max:255',
|
|
|
|
|
|
|
+ return [
|
|
|
|
|
+ 'student_id' => 'required|exists:students,id',
|
|
|
|
|
+ 'name' => 'required|string|max:255',
|
|
|
|
|
+ 'birth_date' => 'required|date',
|
|
|
|
|
+ 'cpf' => 'required|string|max:20',
|
|
|
|
|
+ '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',
|
|
|
];
|
|
];
|
|
|
-
|
|
|
|
|
- // Different rules for creation
|
|
|
|
|
- //if ($this->isMethod('POST')) {
|
|
|
|
|
- // Make fields required if needed
|
|
|
|
|
- // $rules['field'] = 'required|string|max:255';
|
|
|
|
|
- //}
|
|
|
|
|
-
|
|
|
|
|
- return $rules;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Add custom messages when needed
|
|
|
|
|
- * public function messages(): array
|
|
|
|
|
- * {
|
|
|
|
|
- * return [
|
|
|
|
|
- * 'field.required' => __('message.algo'),
|
|
|
|
|
- * ];
|
|
|
|
|
- * }
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ 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.',
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|