where('student_id', $data['student_id']) ->where('id', '!=', $this->record->id) // ignore current record ->exists(); if ($exists) { Notification::make() ->title('Failed to save') ->body('An assessment for this teacher, subject, and student combination already exists.') ->danger() ->send(); $this->halt(); } return $data; } protected function getHeaderActions(): array { return [ Actions\DeleteAction::make(), ]; } }