]> BookStack Code Mirror - bookstack/blob - app/Activity/Notifications/Messages/PageCreationNotification.php
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / app / Activity / Notifications / Messages / PageCreationNotification.php
1 <?php
2
3 namespace BookStack\Activity\Notifications\Messages;
4
5 use BookStack\Activity\Notifications\MessageParts\EntityLinkMessageLine;
6 use BookStack\Activity\Notifications\MessageParts\ListMessageLine;
7 use BookStack\Entities\Models\Page;
8 use BookStack\Users\Models\User;
9 use Illuminate\Notifications\Messages\MailMessage;
10
11 class PageCreationNotification extends BaseActivityNotification
12 {
13     public function toMail(User $notifiable): MailMessage
14     {
15         /** @var Page $page */
16         $page = $this->detail;
17
18         $locale = $notifiable->getLocale();
19
20         $listLines = array_filter([
21             $locale->trans('notifications.detail_page_name') => new EntityLinkMessageLine($page),
22             $locale->trans('notifications.detail_page_path') => $this->buildPagePathLine($page, $notifiable),
23             $locale->trans('notifications.detail_created_by') => $this->user->name,
24         ]);
25
26         return $this->newMailMessage($locale)
27             ->subject($locale->trans('notifications.new_page_subject', ['pageName' => $page->getShortName()]))
28             ->line($locale->trans('notifications.new_page_intro', ['appName' => setting('app-name')]))
29             ->line(new ListMessageLine($listLines))
30             ->action($locale->trans('notifications.action_view_page'), $page->getUrl())
31             ->line($this->buildReasonFooterLine($locale));
32     }
33 }