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