public function handleApiEvent($event)
    {
        $eventName = str_replace('.queued', null, $event->name);
        $ckey = 'event:' . $eventName;
        $records = Cache::remember($ckey, Config::get('df.default_cache_ttl'), function () use ($eventName) {
            return ServiceEventMap::whereEvent($eventName)->get()->all();
        });
        if (empty($records)) {
            // Look for wildcard events by service (example: user.*)
            $serviceName = substr($eventName, 0, strpos($eventName, '.'));
            $wildcardEvent = $serviceName . '.*';
            $ckey = 'event:' . $wildcardEvent;
            $records = Cache::remember($ckey, Config::get('df.default_cache_ttl'), function () use ($wildcardEvent) {
                return ServiceEventMap::whereEvent($wildcardEvent)->get()->all();
            });
        }

        /** @var BaseModel $record */
        foreach ($records as $record) {
            Log::debug('Service event handled: ' . $eventName);
            /** @var BaseRestService $service */
            $service = \ServiceManager::getServiceById($record->service_id);
            Event::fire(new ServiceAssignedEvent($service, $event, $record->toArray()));
        }
    }
public function handleApiEvent($event)
    {
        $eventName = str_replace('.queued', null, $event->name);
        $ckey = 'event:' . $eventName;
        $records = Cache::remember($ckey, Config::get('df.default_cache_ttl'), function () use ($eventName) {
            return ServiceEventMap::whereEvent($eventName)->get()->all();
        });
        if (empty($records)) {
            // Look for wildcard events by service (example: user.*)
            $serviceName = substr($eventName, 0, strpos($eventName, '.'));
            $wildcardEvent = $serviceName . '.*';
            $ckey = 'event:' . $wildcardEvent;
            $records = Cache::remember($ckey, Config::get('df.default_cache_ttl'), function () use ($wildcardEvent) {
                return ServiceEventMap::whereEvent($wildcardEvent)->get()->all();
            });
        }

        /** @var BaseModel $record */
        foreach ($records as $record) {
            Log::debug('Service event handled: ' . $eventName);
            /** @var BaseRestService $service */
            $service = \ServiceManager::getServiceById($record->service_id);
            Event::fire(new ServiceAssignedEvent($service, $event, $record->toArray()));
        }
    }
public function handleApiEvent ( $ event ) { $ eventName = str_replace ( '.queued' , null , $ event -> name ) ; $ ckey = 'event:' . $ eventName ; $ records = Cache :: remember ( $ ckey , Config :: get ( 'df.default_cache_ttl' ) , function ( ) use ( $ eventName ) { return ServiceEventMap :: whereEvent ( $ eventName ) -> get ( ) -> all ( ) ; } ) ; if ( empty ( $ records ) ) { // Look for wildcard events by service (example: user.*) $ serviceName = substr ( $ eventName , 0 , strpos ( $ eventName , '.' ) ) ; $ wildcardEvent = $ serviceName . '.*' ; $ ckey = 'event:' . $ wildcardEvent ; $ records = Cache :: remember ( $ ckey , Config :: get ( 'df.default_cache_ttl' ) , function ( ) use ( $ wildcardEvent ) { return ServiceEventMap :: whereEvent ( $ wildcardEvent ) -> get ( ) -> all ( ) ; } ) ; } /** @var BaseModel $record */ foreach ( $ records as $ record ) { Log :: debug ( 'Service event handled: ' . $ eventName ) ; /** @var BaseRestService $service */ $ service = \ ServiceManager :: getServiceById ( $ record -> service_id ) ; Event :: fire ( new ServiceAssignedEvent ( $ service , $ event , $ record -> toArray ( ) ) ) ; } }
Handle API events.

@param ApiEvent $event
Handle API events .