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