Page MenuHomeDevCentral

ReportServiceProvider.php
No OneTemporary

ReportServiceProvider.php

<?php
namespace Nasqueron\Notifications\Providers;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use Nasqueron\Notifications\Actions\ActionsReport;
use Nasqueron\Notifications\Events\ReportEvent;
class ReportServiceProvider extends ServiceProvider {
/**
* Registers the application services.
*
* @return void
*/
public function register() {
$this->app->singleton('report', function (Application $app) {
$report = new ActionsReport();
static::listenToActionsForReport($report, $app['events']);
return $report;
});
}
/**
* Listen to actions fired by the application to add to the report
*
* @param Nasqueron\Notifications\Actions\ActionsReport $report The report to add actions to
* @param Illuminate\Contracts\Events\Dispatcher $events The application events dispatcher
*/
public static function listenToActionsForReport (ActionsReport $report, Dispatcher $events) {
$events->listen(
'Nasqueron\Notifications\Events\ReportEvent',
function (ReportEvent $event) use ($report) {
$report->addAction($event->action);
}
);
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Feb 28, 21:39 (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2436070
Default Alt Text
ReportServiceProvider.php (1 KB)

Event Timeline