3 namespace BookStack\Activity\Notifications\Messages;
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;
11 class PageCreationNotification extends BaseActivityNotification
13 public function toMail(User $notifiable): MailMessage
15 /** @var Page $page */
16 $page = $this->detail;
18 $locale = $notifiable->getLocale();
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,
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));