3 namespace BookStack\Activity\Notifications\Messages;
5 use BookStack\Activity\Notifications\MessageParts\ListMessageLine;
6 use BookStack\Entities\Models\Page;
7 use BookStack\Entities\Models\Chapter;
8 use BookStack\Users\Models\User;
9 use Illuminate\Notifications\Messages\MailMessage;
11 class PageCreationNotification extends BaseActivityNotification
13 public function toMail(User $notifiable): MailMessage
15 /** @var Page $page */
16 $page = $this->detail;
18 $chapterId = $page->chapter_id;
19 $chapter = $chapterId ? Chapter::find($chapterId) : null;
21 $locale = $notifiable->getLocale();
24 $locale->trans('notifications.detail_page_name') => $page->name,
30 $locale->trans('notifications.detail_chapter_name') => $chapter->name,
35 $locale->trans('notifications.detail_book_name') => $book->name,
36 $locale->trans('notifications.detail_created_by') => $this->user->name,
39 return $this->newMailMessage($locale)
40 ->subject($locale->trans('notifications.new_page_subject', ['pageName' => $page->getShortName()]))
41 ->line($locale->trans('notifications.new_page_intro', ['appName' => setting('app-name')], $locale))
42 ->line(new ListMessageLine($listMessageData))
43 ->action($locale->trans('notifications.action_view_page'), $page->getUrl())
44 ->line($this->buildReasonFooterLine($locale));