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