当前位置: 首页>>代码示例>>PHP>>正文


PHP Dispatcher::fire方法代码示例

本文整理汇总了PHP中Illuminate\Events\Dispatcher::fire方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::fire方法的具体用法?PHP Dispatcher::fire怎么用?PHP Dispatcher::fire使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Events\Dispatcher的用法示例。


在下文中一共展示了Dispatcher::fire方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: filter

 /**
  * @param $route
  * @param $request
  * @param null $scope
  * @return null|BridgeResponse
  */
 public function filter($route, $request, $scope = null)
 {
     $beforeAccessResult = $this->dispatcher->until('oauth.access.before', array($scope));
     if ($beforeAccessResult) {
         return null;
     }
     /** @var BridgeRequest $bridgeRequest */
     $bridgeRequest = BridgeRequest::createFromRequest($request);
     $bridgeResponse = new BridgeResponse();
     $resController = $this->server->getResourceController();
     if (!$resController->verifyResourceRequest($bridgeRequest, $bridgeResponse, $scope)) {
         $this->dispatcher->fire('oauth.access.failed');
         return $bridgeResponse;
     }
     $token = $resController->getAccessTokenData($bridgeRequest, $bridgeResponse);
     $client = $this->clientRepo->find($token['client_id']);
     $tokenScope = $token['scope'];
     $user = null;
     if (isset($token['user_id'])) {
         $user = $this->userProvider->retrieveById($token['user_id']);
     }
     if ($tokenScope) {
         $tokenScope = explode(' ', $tokenScope);
     }
     $eventPayload = array($client, $user, $tokenScope);
     $this->dispatcher->fire('oauth.access.valid', $eventPayload);
 }
开发者ID:tappleby,项目名称:laravel-oauth2-server,代码行数:33,代码来源:AccessFilter.php

示例2: sync

 /**
  * Send Laravel's Session Id to server via ZMQ
  * before client's websocket connection
  * 
  * @return void
  */
 public function sync($message)
 {
     $socket = $this->getSocket();
     $message = json_encode($message);
     // Fire events
     $this->events->fire('sid.sync', [$socket, $message]);
 }
开发者ID:redbaron76,项目名称:larapush,代码行数:13,代码来源:Larapush.php

示例3: dispatch

 /**
  * Dispatches the array of events, firing off the appropriate event name for each and logging the event fired.
  *
  * @param array $events
  */
 public function dispatch(array $events)
 {
     foreach ($events as $event) {
         $eventName = $this->getEventName($event);
         $this->log->info("New event [{$eventName}]", get_object_vars($event));
         $this->event->fire($eventName, $event);
     }
 }
开发者ID:tectonic,项目名称:application-support,代码行数:13,代码来源:EventDispatcher.php

示例4: set

 /**
  * Change the current theme property.
  *
  * @param string $theme
  * @return void
  */
 public function set($theme)
 {
     if (!is_string($theme)) {
         throw new InvalidArgumentException('$theme parameter must be a string.');
     }
     $this->currentTheme = $theme;
     $this->events->fire('theme.set', array($theme, 1));
 }
开发者ID:mpedrera,项目名称:themify,代码行数:14,代码来源:Themify.php

示例5: dispatch

 /**
  * @param array $events
  */
 public function dispatch(array $events)
 {
     foreach ($events as $event) {
         $eventName = $this->getEventName($event);
         $this->event->fire($eventName, $event);
         $this->log->info("{$eventName} was fired.");
     }
 }
开发者ID:adamgoose,项目名称:commander,代码行数:11,代码来源:EventDispatcher.php

示例6: filter

 function filter($route, $request)
 {
     $payload = $request->header('X-Auth-Token');
     $user = $this->driver->validate($payload);
     if (!$user) {
         throw new NotAuthorizedException();
     }
     $this->events->fire('auth.token.valid', $user);
 }
开发者ID:bytesflipper,项目名称:laravel-auth-token,代码行数:9,代码来源:AuthTokenFilter.php

示例7: transferLocalImages

 /**
  * Transfer local images to cloud storage.
  */
 public function transferLocalImages()
 {
     $this->imageResource->orWhere(function (Builder $query) {
         $query->where('filename', '!=', '');
         $query->whereNotNull('filename');
     })->get()->each(function (Image $image) {
         $this->dispatcher->fire(new NewImageEvent($image));
     });
 }
开发者ID:hughgrigg,项目名称:ching-shop,代码行数:12,代码来源:ImageRepository.php

示例8: dispatch

 /**
  * Release the events on the event stack.
  *
  * @param array $events
  */
 public function dispatch(array $events)
 {
     // For every Event's on the event array
     // It will get the event name from the object Namespace the fire that event
     // Also will write that in the log file as an information log
     foreach ($events as $event) {
         $eventName = $this->getEventName($event);
         $this->event->fire($eventName, $event);
         $this->log->info("{$eventName} was fired");
     }
 }
开发者ID:mikimaine,项目名称:ecommerce,代码行数:16,代码来源:EventDispatcher.php

示例9: destroy

 public function destroy()
 {
     $payload = $this->getAuthToken();
     $user = $this->driver->validate($payload);
     if (!$user) {
         throw new NotAuthorizedException();
     }
     $this->driver->getProvider()->purge($user);
     $this->events->fire('auth.token.deleted', array($user));
     return Response::json(array('success' => true));
 }
开发者ID:schoex,项目名称:Campusmate,代码行数:11,代码来源:AuthTokenController.php

示例10: fireEvent

 /**
  * Fire the given event for the object.
  *
  * @param  string  $event
  * @param  bool    $halt
  * @return mixed
  */
 protected function fireEvent($event, $halt = true)
 {
     if (!isset(static::$dispatcher)) {
         return true;
     }
     // We will append the names of the class to the event to distinguish it from
     // other model events that are fired, allowing us to listen on each model
     // event set individually instead of catching event for all the models.
     $event = "{$event}: " . get_class($this);
     return static::$dispatcher->fire($event, $this);
 }
开发者ID:kamaroly,项目名称:shift,代码行数:18,代码来源:Observable.php

示例11: dispatch

 /**
  * Dispatches an event to all registered listeners.
  *
  * @param string $eventName The name of the event to dispatch. The name of
  *                          the event is the name of the method that is
  *                          invoked on listeners.
  * @param Event  $event     The event to pass to the event handlers/listeners.
  *                          If not supplied, an empty Event instance is created.
  *
  * @return Event
  */
 public function dispatch($eventName, Event $event = null)
 {
     if ($event === null) {
         $event = new Event();
     }
     $event->setName($eventName);
     $event->setDispatcher($this);
     $this->laravelDispatcher->fire($eventName, $event);
     $this->symfonyDispatcher->dispatch($eventName, $event);
     $event->setDispatcher($this);
     return $event;
 }
开发者ID:hiddeco,项目名称:laravel-http-adapter,代码行数:23,代码来源:AbstractEventDispatcher.php

示例12: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire(Dispatcher $dispatcher)
 {
     $dispatcher->fire('zip_codes.update.starting');
     $this->counties = County::all();
     $url = $this->getRemoteZipCodeFile();
     $parser = app(RemoteZipCodeFileParser::class);
     $parser->parse($url, function (RemoteZipCodeObject $object) {
         $municipality = $this->updateMunicipality($object->municipality_id, $object->municipality_name);
         $this->updateZipCode($municipality, $object->id, $object->name);
     });
     $dispatcher->fire(new ZipCodesUpdated($this->added, $this->changed));
 }
开发者ID:phaza,项目名称:laravel-norwegian-zip-codes,代码行数:17,代码来源:UpdateZipCodesCommand.php

示例13: handle

 /**
  * @return void
  */
 public function handle()
 {
     $params = [];
     if ($id = $this->argument('id')) {
         $params['id'] = explode(',', $id);
     }
     if ($types = $this->option('types')) {
         $params['types'] = explode(',', $types);
     }
     $this->dispatcher->fire(new PreEventStoreReplay());
     $this->replayService->replay($params);
     $this->dispatcher->fire(new PostEventStoreReplay());
 }
开发者ID:madewithlove,项目名称:laravel-cqrs-es,代码行数:16,代码来源:Replay.php

示例14: dispatch

 /**
  * Dispatch the events
  *
  * @param array $events
  * @param bool  $log
  */
 public function dispatch(array $events, $log = false)
 {
     foreach ($events as $event) {
         // Get the name of the event
         $eventName = $this->getEventName($event);
         // Fire the event
         $this->event->fire($eventName, [$event]);
         if ($log) {
             // Log that the event was fired
             $this->logger->info("Event [{$eventName}] was fired.");
         }
     }
 }
开发者ID:inda5th,项目名称:laravel-eventer,代码行数:19,代码来源:EventDispatcher.php

示例15: postInstall

 public function postInstall(Request $request, Installer $installer, Dispatcher $dispatcher)
 {
     $output = new BufferedOutput();
     $installer->setFieldValues($request->all());
     $versions = $installer->getVersions();
     foreach ($versions as $version) {
         $tasks = $installer->getTasksForVersion($version);
         foreach ($tasks as $task) {
             $output->writeln('<span class="text-info">Running ' . $task->getTitle() . ' Task...</span>');
             try {
                 $task->setInput($installer->getFieldValues());
                 $task->run($output);
             } catch (TaskRunException $e) {
                 $output->writeln('<span class="text-danger">' . $e->getMessage() . '</span>');
                 return new JsonResponse(['output' => $output, 'status' => 'error'], 200);
             }
             $output->writeln('<span class="text-info">Task ' . $task->getTitle() . ' Completed!</span>');
         }
     }
     $dispatcher->fire(new AfterInstallEvent($installer, $output));
     $installer->saveCompleted();
     $output->writeln('<span class="text-success">Installation Completed!</span>');
     $output = array_filter(explode("\n", $output->fetch()));
     return new JsonResponse(['output' => $output, 'status' => 'success'], 200);
 }
开发者ID:illuminate3,项目名称:larastaller,代码行数:25,代码来源:InstallController.php


注:本文中的Illuminate\Events\Dispatcher::fire方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。