本文整理汇总了PHP中Event::subscribe方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::subscribe方法的具体用法?PHP Event::subscribe怎么用?PHP Event::subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::subscribe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerSubscriber
/**
* イベントハンドラーをSubscriberに登録
*/
protected function registerSubscriber()
{
// メール送信イベントハンドラー
if (config('notification.enabled')) {
\Event::subscribe('\\Owl\\Handlers\\Events\\EmailNotification');
}
}
示例2: register
public function register()
{
\Event::subscribe('Cms\\Events\\Crud\\PublicViewsEventHandler');
\Event::subscribe('Cms\\Events\\Crud\\PublicRoutesEventHandler');
\Event::subscribe('Cms\\Events\\Crud\\EntitiesEventHandler');
\Event::subscribe('Cms\\Events\\Crud\\EntityAttributesEventHandler');
}
示例3: register
public function register()
{
$subscriber = new EventDetrSendMailSubcriber();
\Event::subscribe($subscriber);
//hoặc code ở dứoi
// $this->app->events->subscribe(new EventDetrSendMailSubcriber);
}
示例4: register
public function register()
{
if (!config('df.standalone')) {
if (!class_exists(ManagedServiceProvider::class)) {
throw new NotImplementedException('Package not installed. For non-standalone instance df-managed package is required.');
}
$this->app->register(ManagedServiceProvider::class);
}
$subscriber = new ServiceEventHandler();
\Event::subscribe($subscriber);
}
示例5: registerSubscriber
/**
* イベントハンドラーをSubscriberに登録
*/
protected function registerSubscriber()
{
// メール送信イベントハンドラー
if (config('notification.enabled')) {
\Event::subscribe('\\Owl\\Handlers\\Events\\EmailNotification');
}
// Slack通知イベントハンドラー
$slack_webhook_url = config('notification.slack.webhook_url');
// for PHP <= 5.4
if (config('notification.slack.enabled') && !empty($slack_webhook_url)) {
\Event::subscribe('\\Owl\\Handlers\\Events\\SlackNotification');
}
}
示例6: handleUserLogin
/**
* Handling the post data from login form
* and checking authentication.
* @return Response redirect
*/
public function handleUserLogin()
{
// fetch the post data
$postData = Input::all();
// credentails array
$credentials = array('email' => $postData['username'], 'password' => $postData['password']);
// checking the authentication
if (Auth::attempt($credentials)) {
// Firing the login event
$subscriber = new UserEventHandler();
Event::subscribe($subscriber);
$event = Event::fire('user.login', array(Auth::user()));
// Redirect to dashboard
return Redirect::intended('dashboard');
} else {
return Redirect::back();
}
}
示例7: handleUserAuthentication
/**
* This function is handling the post data from the login page.
*
* @return mixed
*/
public function handleUserAuthentication()
{
$username = Input::get('email');
$password = Input::get('password');
$SentryUser = new SentryUser();
if ($SentryUser->authenticateUser($username, $password)) {
SentryHelper::setMessage('Login successful', 'success');
$user = Session::get('userObj');
// getting the user object from session to pass to the event.
/* firing the login event */
$userSubscriber = new SentryuserEventHandler();
Event::subscribe($userSubscriber);
Event::fire('sentryuser.login', array($user));
// user will be redirected to the configured dashboard.
return Redirect::to($this->dashboard);
} else {
return Redirect::to('user');
}
}
示例8: array
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
|
*/
App::down(function () {
return Response::view('errors.503', array(), 503);
});
/*
|--------------------------------------------------------------------------
| Register Events Handlers
|--------------------------------------------------------------------------
*/
Event::subscribe('BestBant\\Handlers\\UserEventHandler');
/*
|--------------------------------------------------------------------------
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
require app_path() . '/filters.php';
示例9: array
$similar[] = $budget->id;
}
}
if (count($similar) > 0) {
// get all transactions for these budgets:
$amounts = array();
$transactions = Auth::user()->transactions()->orderBy('date', 'DESC')->where('onetime', '=', 0)->whereIn('budget_id', $similar)->get();
foreach ($transactions as $t) {
$date = new Carbon($t->date);
$day = intval($date->format('d'));
$amounts[$day] = isset($amounts[$day]) ? $amounts[$day] + floatval($t->amount) * -1 : floatval($t->amount) * -1;
}
// then make sure it's "average".
foreach ($amounts as $day => $amount) {
// save as budget prediction point.
$bpp = new Budgetpredictionpoint();
$bpp->budget_id = $event->id;
$bpp->amount = $amount / count($similar);
$bpp->day = $day;
$bpp->save();
}
}
}
public function subscribe($events)
{
$events->listen('eloquent.saved: Budget', 'BudgetEventHandler@updateBudgetPrediction');
}
}
$BudgetHandler = new BudgetEventHandler();
Event::subscribe($BudgetHandler);
示例10: function
<?php
/*
|--------------------------------------------------------------------------
| Event Handlers
|--------------------------------------------------------------------------
|
| Here is where you can register event handlers that subscribe to
| particular event types
|
*/
Event::subscribe('Zeropingheroes\\Lanager\\Domain\\Users\\UserHandler');
// Log all service actions
Event::listen('lanager.services.*', function ($parameters) {
$eventName = str_replace('lanager.services.', '', Event::firing());
$username = is_object(Auth::user()) ? Auth::user()->username : 'guest';
Log::debug(e($username) . ': ' . $eventName, $parameters);
});
示例11: function
<?php
/**
* This file is part of the Kodazzi Framework.
*
* (c) Jorge Gaitan <info@kodazzi.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
Event::listener('kernel.request', function ($event){
});
*/
Event::subscribe(new Listeners\ContactListener());
示例12: function
<?php
/**
* This file is part of the Kodazzi Framework.
*
* (c) Jorge Gaitan <jgaitan@kodazzi.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
Event::listener('kernel.request', function ($event){
});
*/
Event::subscribe(new Listeners\ContactListener());
Event::subscribe(new Listeners\ShortcutsListener());
示例13:
<?php
Event::subscribe('UserEventHandler');
示例14:
<?php
# USER EVENTS
Event::subscribe('App\\Events\\UserEvents');
示例15: register
public function register()
{
$subscriber = new ServiceEventHandler();
\Event::subscribe($subscriber);
}