/** * イベントハンドラーをSubscriberに登録 */ protected function registerSubscriber() { // メール送信イベントハンドラー if (config('notification.enabled')) { \Event::subscribe('\\Owl\\Handlers\\Events\\EmailNotification'); } }
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'); }
public function register() { $subscriber = new EventDetrSendMailSubcriber(); \Event::subscribe($subscriber); //hoặc code ở dứoi // $this->app->events->subscribe(new EventDetrSendMailSubcriber); }
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); }
/** * イベントハンドラーを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'); } }
/** * 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(); } }
/** * 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'); } }
}); /* |-------------------------------------------------------------------------- | 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';
$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);
<?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 : '******'; Log::debug(e($username) . ': ' . $eventName, $parameters); });
<?php /** * This file is part of the Kodazzi Framework. * * (c) Jorge Gaitan <*****@*****.**> * * 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());
<?php /** * This file is part of the Kodazzi Framework. * * (c) Jorge Gaitan <*****@*****.**> * * 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());
<?php Event::subscribe('UserEventHandler');
<?php # USER EVENTS Event::subscribe('App\\Events\\UserEvents');
<?php Event::subscribe('Ssms\\Notifications\\Events\\EventHandler');
public function register() { $subscriber = new ServiceEventHandler(); \Event::subscribe($subscriber); }
} else { return null; } } }); /* |-------------------------------------------------------------------------- | 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 maintenace mode is in effect for this application. | */ App::down(function () { return Response::make("Be right back!", 503); }); Event::subscribe('UserEventHandler'); Event::subscribe('InvoiceEventHandler'); /* |-------------------------------------------------------------------------- | 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';
Log::error($exception); }); /* |-------------------------------------------------------------------------- | 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 maintenace mode is in effect for this application. | */ App::down(function () { return Response::make("Be right back!", 503); }); /* * Register Events */ Event::subscribe(new NotificationEventHandler()); Event::subscribe(new SessionEventHandler()); /* |-------------------------------------------------------------------------- | 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';
<?php Event::subscribe('App\\Handlers\\CartEventHandler'); Event::subscribe('App\\Handlers\\UserEventHandler');
<?php // Subscribe to User Mailer events Event::subscribe('Lavalite\\User\\Mailers\\UserMailer');
Route::controller('auth', 'AuthController'); Route::get('/', function () { return Redirect::to('donor'); }); Route::group(['before' => 'auth'], function () { Route::resource('location', 'LocationController'); //Route::controller('location', 'LocationController'); // Route::resource('donor', 'DonorController'); Route::resource('donor', 'DonorController', array('except' => array('show'))); Route::controller('donor', 'DonorController'); Route::get('donation/mobile', array('as' => 'donation.getMobile', 'uses' => 'DonationController@getMobile')); Route::resource('donation', 'DonationController'); Route::controller('donation', 'DonationController'); //Route::get('user/profile', array('as' => 'profile', 'uses' => 'UserController@showProfile')); Route::resource('product', 'ProductController'); Route::resource('user', 'UserController'); Route::resource('adjustment', 'AdjustmentController'); Route::controller('report', 'ReportController'); Route::controller('download', 'DownloadController'); Route::resource('ui', 'UiController'); Route::controller('notification', 'NotificationController'); Route::resource('notification', 'NotificationController'); }); /** * Subscribe custom event classes */ $donationsEventHandler = new DonationsEventHandler(); $adjustmentsEventHandler = new AdjustmentsEventHandler(); Event::subscribe($donationsEventHandler); Event::subscribe($adjustmentsEventHandler);
<?php /** * Mailuri referitoare clienti **/ Event::subscribe('\\Mailers\\ClientMailer');
<?php // User Login event Event::listen('sentinel.user.login', function ($user) { Session::put('userId', $user->id); Session::put('email', $user->email); }, 10); // User logout event Event::listen('sentinel.user.logout', function () { Session::flush(); }, 10); // Subscribe to User Mailer events Event::subscribe('Sentinel\\Mailers\\UserMailer');
*/ App::error(function (Exception $exception, $code) { Log::error($exception); }); /* |-------------------------------------------------------------------------- | 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::make("Be right back!", 503); }); /* |-------------------------------------------------------------------------- | 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() . '/handlers/TenantEventHandler.php'; Event::subscribe('Events\\TenantEventHandler'); require app_path() . '/filters.php'; require app_path() . '/errors.php';
<?php /* |-------------------------------------------------------------------------- | Editable subscriber |-------------------------------------------------------------------------- | | Check if the current record is editable | */ use Jacopo\Authentication\Events\EditableSubscriber; Event::subscribe(new EditableSubscriber()); /* |-------------------------------------------------------------------------- | Profile type permissions subscriber |-------------------------------------------------------------------------- | | Check if the current use can edit the Profile permission types | */ use Jacopo\Authentication\Classes\CustomProfile\Events\ProfilePermissionSubscriber; Event::subscribe(new ProfilePermissionSubscriber());
<?php /* * 系统所有事件订阅处 */ Event::subscribe('CacheEventHandler');
App::error(function (Exception $exception, $code) { Log::error($exception); }); /* |-------------------------------------------------------------------------- | 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 maintenace mode is in effect for this application. | */ App::down(function () { return Response::make("Be right back!", 503); }); /* |-------------------------------------------------------------------------- | 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. | */ /* * Register Events */ Event::subscribe(new NotificationEventHandler()); require app_path() . '/filters.php';
<?php // User Login event Event::listen('session.login', function ($data) { Session::put('user', $data); }); // User logout event Event::listen('session.logout', function () { Session::flush(); }); // User mailer event Event::subscribe('Users\\Mailer\\UserMailer');
<?php /* * This file is part of Bootstrap CMS. * * (c) Graham Campbell <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ use GrahamCampbell\BootstrapCMS\Facades\PageRepository; /* |-------------------------------------------------------------------------- | Application Event Listeners |-------------------------------------------------------------------------- | | Here is where you can register all of the listeners for an application. | */ if (Config::get('core.commands')) { $subscriber = App::make('GrahamCampbell\\BootstrapCMS\\Subscribers\\CommandSubscriber'); Event::subscribe($subscriber); } $subscriber = App::make('GrahamCampbell\\BootstrapCMS\\Subscribers\\NavigationSubscriber'); Event::subscribe($subscriber); $observer = App::make('GrahamCampbell\\BootstrapCMS\\Observers\\PageObserver'); PageRepository::observe($observer);
|-------------------------------------------------------------------------- | Bootstrap cache related classes |-------------------------------------------------------------------------- | | Extend laravels file cache with tags functionality and custom cache | invalidator to accompany it so our filesystem won't choke on 1000s of | of old cache files left in storage folder. */ Cache::extend('taggedFile', function ($app) { return new Illuminate\Cache\Repository(new Lib\Extensions\TaggedFileCache()); }); /* |-------------------------------------------------------------------------- | Register view composers |-------------------------------------------------------------------------- */ View::composer('Dashboard.Partials.StatsBar', 'Lib\\Composers\\DashStatsbarComposer'); View::composer('Dashboard.Menus.Menus', 'Lib\\Composers\\DashMenusComposer'); Event::subscribe(new Lib\Services\Cache\CacheInvalidator()); ini_set('max_execution_time', 120); //DB::disableQueryLog(); //bind hybrid auth to the container App::bind('Hybrid_Auth', function () { return new Hybrid_Auth(Config::get('hybridauth')); }); $options = App::make('options'); View::share('options', $options); //load plugins if (File::exists(public_path('plugins/streaming/plugin/start.php'))) { File::requireOnce(public_path('plugins/streaming/plugin/start.php')); }