From 995fdd40490ce16ff95e865d6778ddf106820cf1 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Wed, 7 Oct 2015 14:42:39 +0100 Subject: [PATCH] Updated autopresenter --- .../SendIncidentEmailNotificationHandler.php | 21 ++++++------------- ...endMaintenanceEmailNotificationHandler.php | 19 +++++------------ composer.json | 2 +- config/app.php | 2 +- 4 files changed, 13 insertions(+), 31 deletions(-) diff --git a/app/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php b/app/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php index f991b08fb..69b88ddb7 100644 --- a/app/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php +++ b/app/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php @@ -15,7 +15,7 @@ use CachetHQ\Cachet\Events\Incident\IncidentWasReportedEvent; use CachetHQ\Cachet\Models\Subscriber; use Illuminate\Contracts\Mail\MailQueue; use Illuminate\Mail\Message; -use McCool\LaravelAutoPresenter\PresenterDecorator; +use McCool\LaravelAutoPresenter\Facades\AutoPresenter; class SendIncidentEmailNotificationHandler { @@ -33,27 +33,18 @@ class SendIncidentEmailNotificationHandler */ protected $subscriber; - /** - * The presenter instance. - * - * @var \McCool\LaravelAutoPresenter\PresenterDecorator - */ - protected $presenter; - /** * Create a new send incident email notification handler. * - * @param \Illuminate\Contracts\Mail\Mailer $mailer - * @param \CachetHQ\Cachet\Models\Subscriber $subscriber - * @param \McCool\LaravelAutoPresenter\PresenterDecorator $presenter + * @param \Illuminate\Contracts\Mail\Mailer $mailer + * @param \CachetHQ\Cachet\Models\Subscriber $subscriber * * @return void */ - public function __construct(MailQueue $mailer, Subscriber $subscriber, PresenterDecorator $presenter) + public function __construct(MailQueue $mailer, Subscriber $subscriber) { $this->mailer = $mailer; $this->subscriber = $subscriber; - $this->presenter = $presenter; } /** @@ -65,8 +56,8 @@ class SendIncidentEmailNotificationHandler */ public function handle(IncidentWasReportedEvent $event) { - $incident = $this->presenter->decorate($event->incident); - $component = $this->presenter->decorate($event->incident->component); + $incident = AutoPresenter::decorate($event->incident); + $component = AutoPresenter::decorate($event->incident->component); // Only send emails for public incidents. if ($event->incident->visible === 1) { diff --git a/app/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php b/app/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php index baaa44bbe..8ce7e087a 100644 --- a/app/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php +++ b/app/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php @@ -15,7 +15,7 @@ use CachetHQ\Cachet\Events\Incident\MaintenanceWasScheduledEvent; use CachetHQ\Cachet\Models\Subscriber; use Illuminate\Contracts\Mail\MailQueue; use Illuminate\Mail\Message; -use McCool\LaravelAutoPresenter\PresenterDecorator; +use McCool\LaravelAutoPresenter\Facades\AutoPresenter; class SendMaintenanceEmailNotificationHandler { @@ -33,27 +33,18 @@ class SendMaintenanceEmailNotificationHandler */ protected $subscriber; - /** - * The presenter instance. - * - * @var \McCool\LaravelAutoPresenter\PresenterDecorator - */ - protected $presenter; - /** * Create a new send maintenance email notification handler. * - * @param \Illuminate\Contracts\Mail\Mailer $mailer - * @param \CachetHQ\Cachet\Models\Subscriber $subscriber - * @param \McCool\LaravelAutoPresenter\PresenterDecorator $presenter + * @param \Illuminate\Contracts\Mail\Mailer $mailer + * @param \CachetHQ\Cachet\Models\Subscriber $subscriber * * @return void */ - public function __construct(MailQueue $mailer, Subscriber $subscriber, PresenterDecorator $presenter) + public function __construct(MailQueue $mailer, Subscriber $subscriber) { $this->mailer = $mailer; $this->subscriber = $subscriber; - $this->presenter = $presenter; } /** @@ -65,7 +56,7 @@ class SendMaintenanceEmailNotificationHandler */ public function handle(MaintenanceWasScheduledEvent $event) { - $data = $this->presenter->decorate($event->incident); + $data = AutoPresenter::decorate($event->incident); foreach ($this->subscriber->all() as $subscriber) { $mail = [ diff --git a/composer.json b/composer.json index 554a9b4ee..eaf7f0e25 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "graham-campbell/exceptions": "^5.0", "guzzlehttp/guzzle": "^6.1", "jenssegers/date": "^3.0", - "mccool/laravel-auto-presenter": "^3.1", + "mccool/laravel-auto-presenter": "^4.1", "pragmarx/google2fa": "^0.5", "roumen/feed": "^2.9" }, diff --git a/config/app.php b/config/app.php index 556ed61cb..7fe105ef3 100644 --- a/config/app.php +++ b/config/app.php @@ -159,7 +159,7 @@ return [ 'GrahamCampbell\Security\SecurityServiceProvider', 'GrahamCampbell\Throttle\ThrottleServiceProvider', 'Jenssegers\Date\DateServiceProvider', - 'McCool\LaravelAutoPresenter\LaravelAutoPresenterServiceProvider', + 'McCool\LaravelAutoPresenter\AutoPresenterServiceProvider', 'PragmaRX\Google2FA\Vendor\Laravel\ServiceProvider', 'Roumen\Feed\FeedServiceProvider',