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


PHP Event::fire方法代码示例

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


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

示例1: getRename

 /**
  * @return string
  */
 public function getRename()
 {
     $old_name = Input::get('file');
     $new_name = trim(Input::get('new_name'));
     $file_path = parent::getPath('directory');
     $thumb_path = parent::getPath('thumb');
     $old_file = $file_path . $old_name;
     if (!File::isDirectory($old_file)) {
         $extension = File::extension($old_file);
         $new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension;
     }
     $new_file = $file_path . $new_name;
     if (Config::get('lfm.alphanumeric_directory') && preg_match('/[^\\w-]/i', $new_name)) {
         return Lang::get('laravel-filemanager::lfm.error-folder-alnum');
     } elseif (File::exists($new_file)) {
         return Lang::get('laravel-filemanager::lfm.error-rename');
     }
     if (File::isDirectory($old_file)) {
         File::move($old_file, $new_file);
         Event::fire(new FolderWasRenamed($old_file, $new_file));
         return 'OK';
     }
     File::move($old_file, $new_file);
     if ('Images' === $this->file_type) {
         File::move($thumb_path . $old_name, $thumb_path . $new_name);
     }
     Event::fire(new ImageWasRenamed($old_file, $new_file));
     return 'OK';
 }
开发者ID:unisharp,项目名称:laravel-filemanager,代码行数:32,代码来源:RenameController.php

示例2: fire

 /**
  * Execute the console command.
  */
 public function fire()
 {
     $this->line('');
     $this->info('Routes file: app/routes.php');
     $message = 'This will rebuild routes.php with all of the packages that' . ' subscribe to the `toolbox.routes` event.';
     $this->comment($message);
     $this->line('');
     if ($this->confirm('Proceed with the rebuild? [Yes|no]')) {
         $this->line('');
         $this->info('Backing up routes.php ...');
         // Remove the last backup if it exists
         if (File::exists('app/routes.bak.php')) {
             File::delete('app/routes.bak.php');
         }
         // Back up the existing file
         if (File::exists('app/routes.php')) {
             File::move('app/routes.php', 'app/routes.bak.php');
         }
         // Generate new routes
         $this->info('Generating routes...');
         $routes = Event::fire('toolbox.routes');
         // Save new file
         $this->info('Saving new routes.php...');
         if ($routes && !empty($routes)) {
             $routes = $this->getHeader() . implode("\n", $routes);
             File::put('app/routes.php', $routes);
             $this->info('Process completed!');
         } else {
             $this->error('Nothing to save!');
         }
         // Done!
         $this->line('');
     }
 }
开发者ID:impleri,项目名称:laravel-toolbox,代码行数:37,代码来源:RoutesCommand.php

示例3: publishQueue

 /**
  * Save Queue
  *
  * Persist all queued Events into Event Store.
  * @return void
  */
 public function publishQueue()
 {
     foreach (static::$queue as $record) {
         EventBus::fire('publish:' . $record['event'], $record['payload']);
     }
     static::$queue = [];
 }
开发者ID:C4Tech,项目名称:laravel-ray-emitter,代码行数:13,代码来源:Store.php

示例4: handle

 /**
  * Handles the event
  * @param  Event  $event
  * @return void
  */
 public function handle(Event $event)
 {
     $subscription = $this->storage->subscription($event->customer(), true);
     // we are not doing anything special here,
     // just firing the event to be handeled by the app.
     IlluminateEvent::fire('cashew.invoice.created', array($subscription['user_id'], $event->invoice()));
 }
开发者ID:owlgrin,项目名称:cashew,代码行数:12,代码来源:InvoiceCreateHook.php

示例5: handle

 public function handle()
 {
     $this->deleteChildren();
     $this->reassignURLs();
     PageFacade::delete($this->page);
     Event::fire(new PageWasDeleted($this->page));
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:7,代码来源:DeletePage.php

示例6: fire

 /**
  * @param $api_function
  * @param mixed $data
  * @return mixed
  */
 public static function fire($api_function, $data = false)
 {
     if (isset(self::$hooks[$api_function])) {
         $fns = self::$hooks[$api_function];
         if (is_array($fns)) {
             $resp = array();
             foreach ($fns as $fn) {
                 if (is_callable($fn)) {
                     $resp[] = call_user_func($fn, $data);
                 } elseif (function_exists($fn)) {
                     $resp[] = $fn($data);
                 }
             }
         }
     }
     $args = func_get_args();
     $query = array_shift($args);
     if (count($args) == 1) {
         $args = $args[0];
         if (is_array($args)) {
             $args = array($args);
         }
     }
     return Event::fire($api_function, $args);
 }
开发者ID:Git-Host,项目名称:microweber,代码行数:30,代码来源:LaravelEvent.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  UserRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(UserRequest $request)
 {
     $user = $this->userRepository->save($request->all());
     Event::fire(new SendMail($user));
     Session::flash('message', 'User successfully added!');
     return redirect('user');
 }
开发者ID:arsenaltech,项目名称:folio,代码行数:13,代码来源:UserController.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $category = $this->categoryRepo->insert($request->input());
     Event::fire(new CategoryCreated($category));
     // TODO: flash message
     return redirect()->back();
 }
开发者ID:karlos545,项目名称:takeaway,代码行数:13,代码来源:CategoriesController.php

示例9: getRegisteredSettings

 /**
  * Handle registering and returning registered settings.
  *
  * @return array
  */
 public function getRegisteredSettings()
 {
     $registry = new SettingsRegistry();
     $registry->register('General', [['name' => 'app.site.name', 'type' => 'text', 'label' => 'Site name', 'options' => ['required' => 'required']], ['name' => 'app.site.desc', 'type' => 'text', 'label' => 'Site desc', 'options' => ['required' => 'required']]]);
     Event::fire('register.settings', [$registry]);
     return $registry->collectSettings();
 }
开发者ID:kamaroly,项目名称:shift,代码行数:12,代码来源:SettingsService.php

示例10: deleteType

 public static function deleteType($id)
 {
     // firing event so it can get catched for permission handling
     Event::fire('customprofile.deleting');
     $success = ProfileFieldType::findOrFail($id)->delete();
     return $success;
 }
开发者ID:donotgowiththeflow,项目名称:laravel-acl-seeinfront,代码行数:7,代码来源:CustomProfileRepository.php

示例11: handle

 /**
  * Write a logout history item for this user
  *
  * @param $user
  */
 public static function handle($user)
 {
     $user->login_history()->save(new UserLoginHistory(['source' => Request::getClientIp(), 'user_agent' => Request::header('User-Agent'), 'action' => 'logout']));
     $message = 'User logged out from ' . Request::getClientIp();
     Event::fire('security.log', [$message, 'authentication']);
     return;
 }
开发者ID:freedenizen,项目名称:web,代码行数:12,代码来源:Logout.php

示例12: activate

 /**
  * Activates a Gist for voting via Eloquent.
  *
  * @param $id
  * @param $userId
  */
 public function activate($id, $userId)
 {
     $gist = EloquentGist::where('id', $id)->where('user_id', $userId)->first();
     $gist->enable_voting = true;
     $gist->save();
     Event::fire(new GistWasActivated($gist));
 }
开发者ID:cybercog,项目名称:gistvote,代码行数:13,代码来源:GistRepository.php

示例13: index

 public function index()
 {
     Event::fire(new LogoutEvent($this->person, $this->request));
     $url = Session::get('boomcms.redirect_url');
     $this->auth->logout();
     return $url ? redirect()->to($url) : redirect()->back();
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:7,代码来源:Logout.php

示例14: create

 /**
  * Create's an application form.
  *
  * @param User $user
  * @param array $attributes
  * @return mixed
  */
 public function create(User $user, $attributes = array())
 {
     array_set($attributes, 'user_id', $user->id);
     $application = Application::create($attributes);
     Event::fire(new ApplicationSubmittedEvent($application));
     return $application;
 }
开发者ID:Teamelite,项目名称:Dashboard,代码行数:14,代码来源:ApplicationRepositoryContract.php

示例15: upload

 /**
  * Upload an image/file and (for images) create thumbnail
  *
  * @param UploadRequest $request
  * @return string
  */
 public function upload()
 {
     try {
         $res = $this->uploadValidator();
         if (true !== $res) {
             return Lang::get('laravel-filemanager::lfm.error-invalid');
         }
     } catch (\Exception $e) {
         return $e->getMessage();
     }
     $file = Input::file('upload');
     $new_filename = $this->getNewName($file);
     $dest_path = parent::getPath('directory');
     if (File::exists($dest_path . $new_filename)) {
         return Lang::get('laravel-filemanager::lfm.error-file-exist');
     }
     $file->move($dest_path, $new_filename);
     if ('Images' === $this->file_type) {
         $this->makeThumb($dest_path, $new_filename);
     }
     Event::fire(new ImageWasUploaded(realpath($dest_path . '/' . $new_filename)));
     // upload via ckeditor 'Upload' tab
     if (!Input::has('show_list')) {
         return $this->useFile($new_filename);
     }
     return 'OK';
 }
开发者ID:laravel2580,项目名称:llaravel-filemanager,代码行数:33,代码来源:UploadController.php


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