]> BookStack Code Mirror - bookstack/blob - app/Activity/Notifications/Messages/BaseActivityNotification.php
fix Sidebar scrolling at mid-range sceen
[bookstack] / app / Activity / Notifications / Messages / BaseActivityNotification.php
1 <?php
2
3 namespace BookStack\Activity\Notifications\Messages;
4
5 use BookStack\Activity\Models\Loggable;
6 use BookStack\Activity\Notifications\MessageParts\LinkedMailMessageLine;
7 use BookStack\App\MailNotification;
8 use BookStack\Translation\LocaleDefinition;
9 use BookStack\Users\Models\User;
10 use Illuminate\Bus\Queueable;
11
12 abstract class BaseActivityNotification extends MailNotification
13 {
14     use Queueable;
15
16     public function __construct(
17         protected Loggable|string $detail,
18         protected User $user,
19     ) {
20     }
21
22     /**
23      * Get the array representation of the notification.
24      *
25      * @param  mixed  $notifiable
26      * @return array
27      */
28     public function toArray($notifiable)
29     {
30         return [
31             'activity_detail' => $this->detail,
32             'activity_creator' => $this->user,
33         ];
34     }
35
36     /**
37      * Build the common reason footer line used in mail messages.
38      */
39     protected function buildReasonFooterLine(LocaleDefinition $locale): LinkedMailMessageLine
40     {
41         return new LinkedMailMessageLine(
42             url('/preferences/notifications'),
43             $locale->trans('notifications.footer_reason'),
44             $locale->trans('notifications.footer_reason_link'),
45         );
46     }
47 }