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