/** * Handle the event. * * @param \CachetHQ\Cachet\Events\MaintenanceHasScheduledEvent $event */ public function handle(MaintenanceHasScheduledEvent $event) { $data = $this->presenter->decorate($event->incident); foreach ($this->subscriber->all() as $subscriber) { $mail = ['email' => $subscriber->email, 'subject' => 'Scheduled maintenance.', 'status' => $data->humanStatus, 'htmlContent' => $data->formattedMessage, 'textContent' => $data->message, 'token' => $subscriber->token, 'unsubscribeLink' => route('unsubscribe', ['code' => $subscriber->token]), 'appUrl' => env('APP_URL')]; $this->mailer->queue(['html' => 'emails.incidents.maintenance-html', 'text' => 'emails.incidents.maintenance-text'], $mail, function (Message $message) use($mail) { $message->to($mail['email'])->subject($mail['subject']); }); } }
/** * @return string */ public function description() { $moderation = $this->moderationRegistry->get($this->getWrappedObject()->moderation); $moderation = $this->presenterDecorator->decorate($moderation); $content = $this->getContentForSubjects($this->getWrappedObject()->subjects()->get()->all()); if ($this->getWrappedObject()->is_reverse) { $description = $moderation->reverseDescribe($content, $this->getSourceFromLog($this->getWrappedObject()), $this->getDestinationFromLog($this->getWrappedObject())); } else { $description = $moderation->describe($content, $this->getSourceFromLog($this->getWrappedObject()), $this->getDestinationFromLog($this->getWrappedObject())); } return $this->getUserProfileLink($this->getWrappedObject()->user) . ' ' . $description; }
/** * Handle the event. * * @param \CachetHQ\Cachet\Events\IncidentHasReportedEvent $event */ public function handle(IncidentHasReportedEvent $event) { $data = $this->presenter->decorate($event->incident); // Only send emails for public incidents. if ($event->incident->visible === 1) { foreach ($this->subscriber->all() as $subscriber) { $mail = ['email' => $subscriber->email, 'subject' => 'New incident reported.', 'status' => $data->humanStatus, 'htmlContent' => $data->formattedMessage, 'textContent' => $data->message, 'token' => $subscriber->token, 'unsubscribeLink' => route('unsubscribe', ['code' => $subscriber->verify_code]), 'appUrl' => env('APP_URL')]; $this->mailer->queue(['html' => 'emails.incidents.new-html', 'text' => 'emails.incidents.new-text'], $mail, function (Message $message) use($mail) { $message->to($mail['email'])->subject($mail['subject']); }); } } }
/** * Handle the event. * * @param \CachetHQ\Cachet\Events\Incident\IncidentHasReportedEvent $event * * @return void */ public function handle(IncidentWasReportedEvent $event) { $incident = $this->presenter->decorate($event->incident); $component = $this->presenter->decorate($event->incident->component); // Only send emails for public incidents. if ($event->incident->visible === 1) { foreach ($this->subscriber->all() as $subscriber) { $mail = ['email' => $subscriber->email, 'subject' => 'New incident reported.', 'has_component' => $event->incident->component ? true : false, 'component_name' => $component ? $component->name : null, 'status' => $incident->humanStatus, 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, 'token' => $subscriber->token, 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]), 'app_url' => env('APP_URL')]; $this->mailer->queue(['html' => 'emails.incidents.new-html', 'text' => 'emails.incidents.new-text'], $mail, function (Message $message) use($mail) { $message->to($mail['email'])->subject($mail['subject']); }); } } }
/** * Get the user's action history. * * @return \Illuminate\Database\Eloquent\Collection */ public function actionHistory() { $history = $this->wrappedObject->actions()->get(); return $this->presenter->decorate($history); }
/** * Get the decorated current user. * * @return \GrahamCampbell\Credentials\Presenters\UserPresenter */ public function getDecoratedUser() { if ($user = $this->sentry->getUser()) { return $this->decorator->decorate($user); } }
/** * @param object $object * * @return BasePresenter */ public function present($object) { return $this->decorator->decorate($object); }