|
|
@@ -15,9 +15,19 @@ public function rules(): array
|
|
|
'student_id' => 'required|integer|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',
|
|
|
+
|
|
|
+ 'cpf' => [
|
|
|
+ 'required',
|
|
|
+ 'string',
|
|
|
+ 'max:20',
|
|
|
+ Cpf::rule(),
|
|
|
+ Rule::unique('student_responsibles', 'cpf')
|
|
|
+ ->where(fn ($query) => $query->where('student_id', $this->input('student_id')))
|
|
|
+ ->ignore($this->route('id')),
|
|
|
+ ],
|
|
|
+
|
|
|
+ 'gender' => 'nullable|string|in:male,female,other,no_preference',
|
|
|
+ 'degree' => 'required|string|max:255',
|
|
|
|
|
|
'email' => [
|
|
|
'required',
|