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


PHP Event::fire方法代码示例

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


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

示例1: postIndex

 public function postIndex()
 {
     $input = Input::only('first_name', 'last_name', 'email', 'username', 'password', 'domain_id');
     $domain_id = Cookie::get('domain_hash') ? Cookie::get('domain_hash') : 'NULL';
     $rules = array('first_name' => 'required|min:1', 'email' => 'required|email|unique:users,email,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'username' => 'required|min:3|must_alpha_num|unique:users,username,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'password' => 'required|min:6');
     $v = Validator::make($input, $rules);
     if ($v->fails()) {
         return Output::push(array('path' => 'register', 'errors' => $v, 'input' => TRUE));
     }
     $profile = new Profile(array('first_name' => $input['first_name'], 'last_name' => $input['last_name'], 'website' => ''));
     $profile->save();
     $user = new User(array('domain_id' => Cookie::get('domain_hash') ? Cookie::get('domain_hash') : NULL, 'email' => $input['email'], 'username' => $input['username'], 'password' => Hash::make($input['password']), 'status' => Cookie::get('domain_hash') ? 4 : 3));
     $user->profile()->associate($profile);
     $user->save();
     if ($user->id) {
         if ($user->status == 4) {
             $this->add_phone_number($user->id);
         }
         $cookie = Cookie::forget('rndext');
         $confirmation = App::make('email-confirmation');
         $confirmation->send($user);
         Mail::send('emails.register', array('new_user' => $input['username']), function ($message) {
             $message->from(Config::get('mail.from.address'), Config::get('mail.from.name'))->to(Input::get('email'))->subject(_('New user registration'));
         });
         Event::fire('logger', array(array('account_register', array('id' => $user->id, 'username' => $user->username), 2)));
         //			return Output::push(array(
         //				'path' => 'register',
         //				'messages' => array('success' => _('You have registered successfully')),
         //				));
         return Redirect::to('register')->with('success', _('You have registered successfully'))->withCookie($cookie);
     } else {
         return Output::push(array('path' => 'register', 'messages' => array('fail' => _('Fail to register')), 'input' => TRUE));
     }
 }
开发者ID:digideskio,项目名称:voip-id,代码行数:34,代码来源:RegisterController.php

示例2: onLogin

 public function onLogin()
 {
     $account = Auth::user()->account;
     $account->last_login = Carbon::now()->toDateTimeString();
     $account->save();
     Event::fire('user.refresh');
 }
开发者ID:poseidonjm,项目名称:invoice-ninja,代码行数:7,代码来源:UserEventHandler.php

示例3: fire

 /**
  * Fires an event.
  * @param Boolean $allow Determines if the event is allowed to fire.
  * @param String $event Name of the event to fire.
  * @param [String => Mixed] $opts
  * @param [String => Mixed] $extra Additional options.
  */
 protected function fire($allow, $event, array $opts, array $extra)
 {
     if ($allow) {
         \Event::fire(ltrim($this->model, '\\') . '.' . $event, [array_merge($opts, $extra)]);
     }
     return $allow;
 }
开发者ID:hsz-develop,项目名称:LearningLocker--learninglocker,代码行数:14,代码来源:EloquentRepository.php

示例4: store

 /**
  * Store a newly created conversation in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = array('users' => 'required|array', 'body' => 'required');
     $validator = Validator::make(Input::only('users', 'body'), $rules);
     if ($validator->fails()) {
         return Response::json(['success' => false, 'result' => $validator->messages()]);
     }
     // Create Conversation
     $params = array('created_at' => new DateTime(), 'name' => str_random(30), 'author_id' => Auth::user()->id);
     $conversation = Conversation::create($params);
     $conversation->users()->attach(Input::get('users'));
     $conversation->users()->attach(array(Auth::user()->id));
     // Create Message
     $params = array('conversation_id' => $conversation->id, 'body' => Input::get('body'), 'user_id' => Auth::user()->id, 'created_at' => new DateTime());
     $message = Message::create($params);
     // Create Message Notifications
     $messages_notifications = array();
     foreach (Input::get('users') as $user_id) {
         array_push($messages_notifications, new MessageNotification(array('user_id' => $user_id, 'read' => false, 'conversation_id' => $conversation->id)));
         // Publish Data To Redis
         $data = array('room' => $user_id, 'message' => array('conversation_id' => $conversation->id));
         Event::fire(ChatConversationsEventHandler::EVENT, array(json_encode($data)));
     }
     $message->messages_notifications()->saveMany($messages_notifications);
     return Redirect::route('chat.index', array('conversation', $conversation->name));
 }
开发者ID:thantai574,项目名称:laravel-realtime-chat,代码行数:31,代码来源:ConversationController.php

示例5: put_update

 public function put_update()
 {
     $post_modules = Input::get('modules');
     $group_id = Input::get('group_id');
     $action = Input::get('btnAction');
     $post_rules = Input::get('module_roles');
     if (isset($group_id) and !empty($group_id) and ctype_digit($group_id)) {
         Permission::update_permissions($group_id, $post_rules, $post_modules);
         Event::fire('mwi.permissions_updated', array('modules' => $post_modules, 'group_id' => $group_id));
         $this->data['message'] = __('permissions::lang.Permissions were successfully updated')->get(ADM_LANG);
         $this->data['message_type'] = 'success';
         if ($action == 'save') {
             return Redirect::to(ADM_URI . '/permissions/' . $group_id . '/edit')->with($this->data);
         } else {
             // 'save_exit' action
             return Redirect::to(ADM_URI . '/groups')->with($this->data);
         }
     } else {
         // module id's and group_id not posted
         // no changes made
         if ($action == 'save') {
             return Redirect::to(ADM_URI . '/permissions/group/' . $group_id)->with($this->data);
         } else {
             // 'save_exit' action
             return Redirect::to(ADM_URI . '/groups')->with($this->data);
         }
     }
 }
开发者ID:juaniiie,项目名称:mwi,代码行数:28,代码来源:permissions.php

示例6: handle

 public function handle(UserUpdateCommand $command)
 {
     $user = User::find($command->getAuthState()->actingUserId);
     $user->email = $command->email;
     $user->save();
     \Event::fire(new UserUpdatedEvent($user));
 }
开发者ID:slice-beans,项目名称:cqs-framework,代码行数:7,代码来源:UserUpdateCommandHandler.php

示例7: login

 public function login()
 {
     $rules = array('rut' => 'required|between:8,9|alpha_num|rut|exist_rut');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         if (Request::ajax()) {
             return json_encode('ERROR');
         }
         return Redirect::back()->withErrors($validator->messages())->withInput();
     }
     Event::fire('carga_cliente', array(Input::get('rut')));
     $ultima_respuesta = Event::fire('ya_respondio')[0];
     if (!is_null($ultima_respuesta)) {
         $msg = array('data' => array('type' => 'warning', 'title' => Session::get('user_name'), 'text' => 'En el actual periodo, ya registramos tus respuestas con fecha <b>' . $ultima_respuesta->format('d-m-Y') . '</b> a las <b>' . $ultima_respuesta->toTimeString() . '</b>, ¿Deseas actualizar esta información?'), 'options' => array(HTML::link('#', 'NO', array('class' => 'col-xs-4 col-sm-4 col-md-3 btn btn-default btn-lg text-uppercase', 'id' => 'btn_neg')), HTML::link('encuestas', 'SÍ', array('class' => 'col-xs-4 col-sm-4 col-md-3 btn btn-hot btn-lg text-uppercase pull-right'))));
         if (Request::ajax()) {
             return json_encode($msg);
         }
         return View::make('messages')->with('msg', $msg);
     } else {
         if (Request::ajax()) {
             return json_encode('OK');
         }
         return Redirect::to('encuestas');
     }
 }
开发者ID:mazebeat,项目名称:encuesta_umayor,代码行数:25,代码来源:HomeController.php

示例8: action_index

 public function action_index()
 {
     $settings = new Settings();
     $settings->add_setting(new Setting_Preferences($this->user));
     $settings->add_setting(new Setting_Profile($this->user));
     $settings->add_setting(new Setting_Account($this->user));
     // Run the events.
     Event::fire('user.settings', array($this->user, $settings));
     if ($this->request->method() == HTTP_Request::POST) {
         $setting = $settings->get_by_id($this->request->post('settings-tab'));
         if ($setting) {
             $post = $this->request->post();
             $validation = $setting->get_validation($post);
             if ($validation->check()) {
                 try {
                     $setting->save($post);
                     Hint::success('Updated ' . $setting->title . '!');
                 } catch (ORM_Validation_Exception $e) {
                     Hint::error($e->errors('models'));
                 }
             } else {
                 Hint::error($validation->errors());
             }
         } else {
             Hint::error('Invalid settings id!');
         }
     }
     $this->view = new View_User_Settings();
     $this->view->settings = $settings;
 }
开发者ID:modulargaming,项目名称:user,代码行数:30,代码来源:Settings.php

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $key = Input::get('key');
     $deliverydate = Input::get('date');
     $dev = \Device::where('key', '=', $key)->first();
     $model = $this->model;
     $merchants = $model->where('group_id', '=', 4)->get();
     //print_r($merchants);
     //die();
     for ($n = 0; $n < count($merchants); $n++) {
         $or = new \stdClass();
         foreach ($merchants[$n] as $k => $v) {
             $nk = $this->underscoreToCamelCase($k);
             $or->{$nk} = is_null($v) ? '' : $v;
         }
         $or->extId = $or->id;
         unset($or->id);
         //$or->boxList = $this->boxList('delivery_id',$or->deliveryId,$key);
         //$or->boxObjects = $this->boxList('delivery_id',$or->deliveryId, $key , true);
         $merchants[$n] = $or;
     }
     $actor = $key;
     \Event::fire('log.api', array($this->controller_name, 'get', $actor, 'logged out'));
     return $merchants;
     //
 }
开发者ID:awidarto,项目名称:jexadmin,代码行数:31,代码来源:MerchantapiController.php

示例10: find

 /**
  * Find a model by its primary key.
  *
  * @param mixed $id
  * @param array $columns
  *
  * @return \Illuminate\Database\Eloquent\Model|static|null
  */
 public function find($id, $columns = array('*'))
 {
     Event::fire('before.find', array($this));
     $result = parent::find($id, $columns);
     Event::fire('after.find', array($this));
     return $result;
 }
开发者ID:microweber,项目名称:microweber,代码行数:15,代码来源:QueryBuilder.php

示例11: handle

 /**
  * Handle the event.
  *
  * @param  OpenBattleVideoConverted  $event
  * @return void
  */
 public function handle(OpenBattleVideoConverted $event)
 {
     Log::info('Updating OpenBattle', ['battle' => $event->battle->id, 'phase' => $event->battle->phase]);
     $event->battle[$event->videoColumn] = $event->videoFilename;
     // Set beat id
     if ($event->battle->phase == 1) {
         $event->battle['beat' . $event->rapperNumber . '_id'] = $event->beatId;
         // Go to phase 2 if both 1st rounds are uploaded
         if ($event->battle->hasFirstRounds()) {
             Log::debug('Updating OpenBattle: changing phase (before)', ['battle' => $event->battle->id, 'phase' => $event->battle->phase]);
             $event->battle->setPhaseAttribute(2);
             Log::debug('Updating OpenBattle: changing phase (after)', ['battle' => $event->battle->id, 'phase' => $event->battle->phase]);
         }
     } else {
         if ($event->battle->phase == 2 && $event->battle->hasAllRounds()) {
             // note: battle done, concat video, create battle, delete open battle - maybe need to do this when conversion is done
             // input files in filesystem
             $infiles = array();
             $infiles[] = Storage::disk('videos')->getAdapter()->applyPathPrefix($event->battle->rapper1_round1);
             $infiles[] = Storage::disk('videos')->getAdapter()->applyPathPrefix($event->battle->rapper2_round1);
             $infiles[] = Storage::disk('videos')->getAdapter()->applyPathPrefix($event->battle->rapper2_round2);
             $infiles[] = Storage::disk('videos')->getAdapter()->applyPathPrefix($event->battle->rapper1_round2);
             // new video file name
             $this->outfilename = '' . $event->battle->id . '.mp4';
             $outfile = Storage::disk('videos')->getAdapter()->applyPathPrefix($this->outfilename);
             // concatenates the videos, converts the OpenBattle to a Battle and deletes the old video files
             \Event::fire(new VideoWasUploaded($outfile, $infiles, false, new OpenBattleCompleted($event->battle, $this->outfilename)));
         }
     }
     $event->battle->save();
 }
开发者ID:Rap-Battle-App,项目名称:Backend,代码行数:37,代码来源:UpdateOpenBattle.php

示例12: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // Fire event before the Cron jobs will be executed
     \Event::fire('cron.collectJobs');
     $report = Cron::run();
     if ($report['inTime'] === -1) {
         $inTime = -1;
     } else {
         if ($report['inTime']) {
             $inTime = 'true';
         } else {
             $inTime = 'false';
         }
     }
     // Get Laravel version
     $laravel = app();
     $version = $laravel::VERSION;
     if ($version < '5.2') {
         // Create table for old Laravel versions.
         $table = $this->getHelperSet()->get('table');
         $table->setHeaders(array('Run date', 'In time', 'Run time', 'Errors', 'Jobs'));
         $table->addRow(array($report['rundate'], $inTime, round($report['runtime'], 4), $report['errors'], count($report['crons'])));
     } else {
         // Create table for new Laravel versions.
         $table = new \Symfony\Component\Console\Helper\Table($this->getOutput());
         $table->setHeaders(array('Run date', 'In time', 'Run time', 'Errors', 'Jobs'))->setRows(array(array($report['rundate'], $inTime, round($report['runtime'], 4), $report['errors'], count($report['crons']))));
     }
     // Output table.
     $table->render($this->getOutput());
 }
开发者ID:liebig,项目名称:cron,代码行数:35,代码来源:RunCommand.php

示例13: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     User::deleting(function ($user) {
         \Event::fire(new UserWasDeleted($user->id));
     });
 }
开发者ID:Rotron,项目名称:laravel5-shop,代码行数:13,代码来源:EventServiceProvider.php

示例14: write

 /**
  * Write a message to the log file.
  *
  * <code>
  *		// Write an "error" message to the log file
  *		Log::write('error', 'Something went horribly wrong!');
  *
  *		// Write an "error" message using the class' magic method
  *		Log::error('Something went horribly wrong!');
  *
  *		// Log an arrays data
  *		Log::write('info', array('name' => 'Sawny', 'passwd' => '1234', array(1337, 21, 0)), true);
  *      //Result: Array ( [name] => Sawny [passwd] => 1234 [0] => Array ( [0] => 1337 [1] => 21 [2] => 0 ) )
  *      //If we had omit the third parameter the result had been: Array
  * </code>
  *
  * @param  string  $type
  * @param  string  $message
  * @return void
  */
 public static function write($type, $message, $pretty_print = false)
 {
     $message = $pretty_print ? print_r($message, true) : $message;
     // If there is a listener for the log event, we'll delegate the logging
     // to the event and not write to the log files. This allows for quick
     // swapping of log implementations for debugging.
     if (Event::listeners('laravel.log')) {
         Event::fire('laravel.log', array($type, $message));
     }
     $trace = debug_backtrace();
     foreach ($trace as $item) {
         if (isset($item['class']) and $item['class'] == __CLASS__) {
             continue;
         }
         $caller = $item;
         break;
     }
     $function = $caller['function'];
     if (isset($caller['class'])) {
         $class = $caller['class'] . '::';
     } else {
         $class = '';
     }
     $message = static::format($type, $class . $function . ' - ' . $message);
     File::append(path('storage') . 'logs/' . date('Y-m-d') . '.log', $message);
 }
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:46,代码来源:log.php

示例15: publishMenus

 /**
  * @Post("/publish")
  * @Middleware("admin")
  *
  * Admin publishes the menu.
  * 
  */
 public function publishMenus()
 {
     $week = \Input::get('week');
     Menu::where('week', $week)->update(['published' => true]);
     \Event::fire(new MenuWasPublished(Menu::where('week', $week)->first()));
     return Menu::with(['menuFoods', 'menuFoods.menu', 'menuFoods.food'])->where('week', $week)->get();
 }
开发者ID:petarslovic,项目名称:web-hungry,代码行数:14,代码来源:MenuController.php


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