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


PHP Dispatcher::fire方法代码示例

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


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

示例1: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     foreach ($this->permissionsToRegister() as $name => $description) {
         $this->permissionRepository->firstOrRegister(['name' => $name], ['description' => $description]);
     }
     $this->events->fire(new PermissionsModified());
 }
开发者ID:adrianyg7,项目名称:Acl,代码行数:12,代码来源:RegisterPermissions.php

示例2: dispatchEventsFor

 /**
  * Dispatch all events for an entity.
  *
  * @param object $entity
  * @param User $actor
  */
 public function dispatchEventsFor($entity, User $actor = null)
 {
     foreach ($entity->releaseEvents() as $event) {
         $event->actor = $actor;
         $this->events->fire($event);
     }
 }
开发者ID:asifalimd,项目名称:core,代码行数:13,代码来源:DispatchEventsTrait.php

示例3: handle

 /**
  * handle group creation logic
  *
  * @param Validator $validator
  * @param Dispatcher $dispatcher
  * @param Group $group
  * @return CommandResult
  */
 public function handle(Validator $validator, Dispatcher $dispatcher, Group $group)
 {
     // check user permission
     if (!$this->disablePermissionChecking) {
         if (!$this->user->hasAnyPermission(['user.manage'])) {
             return new CommandResult(false, CommandResult::$responseForbiddenMessage, null, 403);
         }
     }
     // validate data
     $validationResult = $validator->make(array('name' => $this->name, 'permissions' => $this->permissions), Group::$rules);
     if ($validationResult->fails()) {
         return new CommandResult(false, $validationResult->getMessageBag()->first(), null, 400);
     }
     // prepare data to be store
     $groupToBeCreated = array('name' => $this->name, 'permissions' => $this->transform($this->permissions));
     // fire creating
     $dispatcher->fire('group.creating', array($groupToBeCreated));
     // create
     $createdGroup = $group->create($groupToBeCreated);
     if (!$createdGroup) {
         return new CommandResult(false, "Failed to create user.", null, 400);
     }
     // fire created user
     $dispatcher->fire('group.created', array($createdGroup));
     // return response
     return new CommandResult(true, "Group successfully created.", $createdGroup, 201);
 }
开发者ID:darryldecode,项目名称:laravelbackend,代码行数:35,代码来源:CreateGroupCommand.php

示例4: makeValidator

 /**
  * Make a new validator instance for this model.
  *
  * @param array $attributes
  * @return \Illuminate\Validation\Validator
  */
 protected function makeValidator(array $attributes)
 {
     $rules = array_only($this->getRules(), array_keys($attributes));
     $validator = $this->validator->make($attributes, $rules, $this->getMessages());
     $this->events->fire(new ConfigureValidator($this, $validator));
     return $validator;
 }
开发者ID:asifalimd,项目名称:core,代码行数:13,代码来源:AbstractValidator.php

示例5: handle

 /**
  * handle user deletion logic
  *
  * @param User $user
  * @param Group $group
  * @param Dispatcher $dispatcher
  * @param Repository $config
  * @return CommandResult
  */
 public function handle(User $user, Group $group, Dispatcher $dispatcher, Repository $config)
 {
     // check user permission
     if (!$this->disablePermissionChecking) {
         if (!$this->user->hasAnyPermission(['user.delete'])) {
             return new CommandResult(false, CommandResult::$responseForbiddenMessage, null, 403);
         }
         if ($this->user->id == $this->id) {
             return new CommandResult(false, "Cannot delete self.", null, 400);
         }
     }
     // prepare the user model
     $user = $this->createUserModel($user, $config);
     // find the user
     if (!($userToBeDelete = $user->find($this->id))) {
         return new CommandResult(false, "User not found.", null, 404);
     }
     // fire deleting
     $dispatcher->fire('user.deleting', array($this->args));
     // begin deletion
     $userToBeDelete->groups()->detach();
     $userToBeDelete->delete();
     // fire deleted
     $dispatcher->fire('user.deleted', array($userToBeDelete));
     // all good
     return new CommandResult(true, "User successfully deleted.", null, 200);
 }
开发者ID:darryldecode,项目名称:laravelbackend,代码行数:36,代码来源:DeleteUserCommand.php

示例6: handle

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     $this->events->fire('command.publishvendors', $this);
     $this->events->fire('command.runmigrations', $this);
     $this->events->fire('command.updatecache', $this);
     $this->events->fire('command.extrastuff', $this);
 }
开发者ID:ssomenzi,项目名称:silence,代码行数:12,代码来源:AppUpdate.php

示例7: handle

 /**
  * Handle the command.
  *
  * @param CreateIncomeServiceCommand $command
  * @return void
  */
 public function handle(CreateIncomeServiceCommand $command)
 {
     $input = ['service_id' => $command->serviceId, 'service_date' => $command->serviceDate, 'created_by' => $command->userId, 'role_access' => $command->roleAccess, 'status' => $command->status];
     $incomeService = $this->incomeService->save($input);
     $this->dispatcher->fire(new IncomeServiceWasCreated($incomeService->id));
     return $incomeService;
 }
开发者ID:jraymundoyrockdev,项目名称:api-gfccm-systems,代码行数:13,代码来源:CreateIncomeServiceCommandHandler.php

示例8: handle

 /**
  * Execute the command.
  *
  * @param ContentType $contentType
  * @param Validator $validator
  * @param Dispatcher $dispatcher
  * @return CommandResult
  */
 public function handle(ContentType $contentType, Validator $validator, Dispatcher $dispatcher)
 {
     // validate authorization
     if (!$this->disablePermissionChecking) {
         if (!$this->user->hasAnyPermission(['contentBuilder.manage'])) {
             return new CommandResult(false, CommandResult::$responseForbiddenMessage, null, 403);
         }
     }
     // validate data
     $validationResult = $validator->make(array('taxonomy' => $this->taxonomy, 'content_type_id' => $this->contentTypeId), ContentTypeTaxonomy::$rules);
     if ($validationResult->fails()) {
         return new CommandResult(false, $validationResult->getMessageBag()->first(), null, 400);
     }
     // prepare the data to be stored
     $taxonomyToBeCreated = array('taxonomy' => $this->taxonomy, 'description' => $this->description);
     // fire creating event
     $dispatcher->fire('contentTypeTaxonomy.creating', array($taxonomyToBeCreated));
     // store
     try {
         $contentType = $contentType->findOrFail($this->contentTypeId);
         $createdContentTypeTaxonomy = $contentType->taxonomies()->create($taxonomyToBeCreated);
     } catch (\Exception $e) {
         return new CommandResult(false, "Invalid Content Type.", null, 400);
     }
     // fire creating event
     $dispatcher->fire('contentTypeTaxonomy.created', array($createdContentTypeTaxonomy));
     // return
     return new CommandResult(true, "Content type taxonomy successfully created.", $createdContentTypeTaxonomy, 201);
 }
开发者ID:darryldecode,项目名称:laravelbackend,代码行数:37,代码来源:CreateContentTypeTaxonomyCommand.php

示例9: handle

 public function handle(Navigation $navigation, Factory $validator, Dispatcher $dispatcher)
 {
     // check if user has permission
     if (!$this->disablePermissionChecking) {
         if (!$this->user->hasAnyPermission(['navigationBuilder.manage'])) {
             return new CommandResult(false, "Not enough permission.", null, 403);
         }
     }
     // validate data
     $validationResult = $validator->make(array('name' => $this->name, 'data' => $this->data), Navigation::$rules);
     if ($validationResult->fails()) {
         return new CommandResult(false, $validationResult->getMessageBag()->first(), null, 400);
     }
     if (!($nav = $navigation->find($this->id))) {
         return new CommandResult(false, 'Navigation does not exist.', null, 400);
     }
     // fire before create event
     $dispatcher->fire('navigationBuilder.updating', array($nav, $this->args));
     $nav->name = $this->name;
     $nav->data = $this->data;
     $nav->save();
     // fire after create
     $dispatcher->fire('navigationBuilder.updated', array($nav, $this->args));
     // all good
     return new CommandResult(true, "Navigation successfully updated.", $nav, 200);
 }
开发者ID:darryldecode,项目名称:laravelbackend,代码行数:26,代码来源:UpdateNavigationCommand.php

示例10: render

 /**
  * {@inheritdoc}
  */
 public function render(Request $request)
 {
     $view = $this->getView($request);
     $this->events->fire(new ConfigureClientView($this, $view, $request));
     $this->events->fire(new ConfigureWebApp($this, $view, $request));
     return $view->render($request);
 }
开发者ID:Luceos,项目名称:core,代码行数:10,代码来源:AbstractWebAppController.php

示例11: run

 /**
  * リマインダー通知ビジネスロジック
  *
  * @param string $message
  */
 public function run($message)
 {
     // イベントにメッセージを設定
     $this->event->message = $message;
     // イベント発行
     $this->dispacher->fire($this->event);
 }
开发者ID:HiroKws,项目名称:zakkuto-laravel-hub-site,代码行数:12,代码来源:Reminder.php

示例12: handle

 /**
  * @param Navigation $navigation
  * @param Dispatcher $dispatcher
  * @return CommandResult
  */
 public function handle(Navigation $navigation, Dispatcher $dispatcher)
 {
     // check if user has permission
     if (!$this->disablePermissionChecking) {
         if (!$this->user->hasAnyPermission(['navigationBuilder.manage'])) {
             return new CommandResult(false, "Not enough permission.", null, 403);
         }
     }
     // fire before create event
     $dispatcher->fire('navigationBuilder.beforeQuery', array($this->args));
     if ($this->id && $this->id != '') {
         if (!($res = $navigation->with(array())->find($this->id))) {
             return new CommandResult(false, "Navigation does not exist.", null, 404);
         }
     } else {
         if ($this->paginated) {
             $res = $navigation->with(array())->paginate($this->perPage);
         } else {
             $res = $navigation->all();
         }
     }
     // fire after create
     $dispatcher->fire('navigationBuilder.afterQuery', array($this->args));
     // all good
     return new CommandResult(true, "List custom navigation command successful.", $res, 200);
 }
开发者ID:darryldecode,项目名称:laravelbackend,代码行数:31,代码来源:ListCustomNavigationCommand.php

示例13: handle

 /**
  * Handle the command.
  *
  * @param  DeleteIncomeServiceMemberFundTotal $command
  * @return void
  */
 public function handle(DeleteIncomeServiceMemberFundTotal $command)
 {
     $memberFund = $this->memberFund->getByIdAndMemberId($command->incomeServiceId, $command->memberId);
     $this->memberFund->deleteTotal($memberFund->id);
     $incomeService = $this->dispatcher->fire(new IncomeServiceMemberFundTotalWasDeleted($command->incomeServiceId, $command->memberId, $memberFund->tithes, $memberFund->offering, $memberFund->others, $memberFund->total));
     return ['memberFundTotal' => $memberFund, 'fundTotal' => $incomeService[1]];
 }
开发者ID:jraymundoyrockdev,项目名称:api-gfccm-systems,代码行数:13,代码来源:DeleteIncomeServiceMemberFundTotalHandler.php

示例14: fireEvent

 /**
  * Fire off an event.
  *
  * @param  string  $name
  * @param  mixed   $payload
  * @return mixed
  */
 protected function fireEvent($name, $payload = null)
 {
     if (!isset(static::$dispatcher)) {
         $this->initEventDispatcher();
     }
     static::$dispatcher->fire($name, $payload);
 }
开发者ID:caffeinated,项目名称:beverage,代码行数:14,代码来源:EventDispatcher.php

示例15: execute

 /**
  * @param CouchbaseViewQuery $viewQuery
  * @param bool               $jsonAsArray
  *
  * @return mixed
  */
 public function execute(CouchbaseViewQuery $viewQuery, $jsonAsArray = false)
 {
     if (isset($this->dispatcher)) {
         $this->dispatcher->fire(new ViewQuerying($viewQuery));
     }
     return $this->bucket->query($viewQuery, $jsonAsArray);
 }
开发者ID:ytake,项目名称:laravel-couchbase,代码行数:13,代码来源:View.php


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