student->entriesForEvent($entry->audition->event_id)->count(); // If less than two entries, they're not a doubler if ($count < 2) { return; } // Update doublers for the event $syncer = app(DoublerSync::class); $syncer($entry->audition->event_id); } /** * Handle the Entry "updated" event. */ public function updated(Entry $entry): void { $syncer = app(DoublerSync::class); // Update doubler table when an entry is updated $syncer(); } /** * Handle the Entry "deleted" event. */ public function deleted(Entry $entry): void { $syncer = app(DoublerSync::class); Doubler::where('student_id', $entry->student_id)->delete(); $audition = Audition::where('id', $entry->audition_id)->first(); $syncer($audition->event_id); } }