[], 'after' => ['publish', 'submit', 'approve'], ]; public function handle(FilingWorkflowEvent $event) { $function = Str::camel($event->transition); return $this->$function($event); } /** * Sends a notification to the client when the $filing is submitted. * * @param FilingWorkflowEvent $event The event object. * @return void */ public function submit(FilingWorkflowEvent $event) { $client = $event->filing->client; Notification::send($client, new FilingWorkflowNotification($event)); } /** * Sends a notification to the client when the $filing is published. * * @param FilingWorkflowEvent $event The event object. * @return void */ public function publish(FilingWorkflowEvent $event) { $client = $event->filing->client; Notification::send($client, new FilingWorkflowNotification($event)); } /** * Sends a notification to the client when the $filing is approved. * * @param FilingWorkflowEvent $event The event object. * @return void */ public function approve(FilingWorkflowEvent $event) { $client = $event->filing->client; Notification::send($client, new FilingWorkflowNotification($event)); } /** * Handles the $filing workflow event as a listener. * * @param FilingWorkflowEvent $event The event object. * @return void */ public function asListener(FilingWorkflowEvent $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); } } }