[], 'after' => ['publish', 'submit', 'approve'], ]; public function handle(AttendeeWorkflowEvent $event) { $function = Str::camel($event->transition); return $this->$function($event); } /** * Sends a notification to the client when the $attendee is submitted. * * @param AttendeeWorkflowEvent $event The event object. * @return void */ public function submit(AttendeeWorkflowEvent $event) { $client = $event->attendee->client; Notification::send($client, new AttendeeWorkflowNotification($event)); } /** * Sends a notification to the client when the $attendee is published. * * @param AttendeeWorkflowEvent $event The event object. * @return void */ public function publish(AttendeeWorkflowEvent $event) { $client = $event->attendee->client; Notification::send($client, new AttendeeWorkflowNotification($event)); } /** * Sends a notification to the client when the $attendee is approved. * * @param AttendeeWorkflowEvent $event The event object. * @return void */ public function approve(AttendeeWorkflowEvent $event) { $client = $event->attendee->client; Notification::send($client, new AttendeeWorkflowNotification($event)); } /** * Handles the $attendee workflow event as a listener. * * @param AttendeeWorkflowEvent $event The event object. * @return void */ public function asListener(AttendeeWorkflowEvent $event) { if (($event->when == 'before' && in_array($event->transition, $this->allowedTransitions['before']) || $event->when == 'after' && in_array($event->transition, $this->allowedTransitions['after'])) ) { return $this->handle($event); } } }