2023-08-04 19:27:29 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\Activity\Notifications\Messages;
|
|
|
|
|
|
|
|
use BookStack\Activity\Models\Loggable;
|
2023-08-15 21:39:39 +08:00
|
|
|
use BookStack\Activity\Notifications\MessageParts\LinkedMailMessageLine;
|
2023-09-02 22:11:42 +08:00
|
|
|
use BookStack\Notifications\MailNotification;
|
2023-08-04 19:27:29 +08:00
|
|
|
use BookStack\Users\Models\User;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
|
2023-09-02 22:11:42 +08:00
|
|
|
abstract class BaseActivityNotification extends MailNotification
|
2023-08-04 19:27:29 +08:00
|
|
|
{
|
|
|
|
use Queueable;
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
protected Loggable|string $detail,
|
|
|
|
protected User $user,
|
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the array representation of the notification.
|
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function toArray($notifiable)
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'activity_detail' => $this->detail,
|
|
|
|
'activity_creator' => $this->user,
|
|
|
|
];
|
|
|
|
}
|
2023-08-15 21:39:39 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Build the common reason footer line used in mail messages.
|
|
|
|
*/
|
2023-09-02 22:11:42 +08:00
|
|
|
protected function buildReasonFooterLine(string $language): LinkedMailMessageLine
|
2023-08-15 21:39:39 +08:00
|
|
|
{
|
|
|
|
return new LinkedMailMessageLine(
|
|
|
|
url('/preferences/notifications'),
|
2023-09-02 22:11:42 +08:00
|
|
|
trans('notifications.footer_reason', [], $language),
|
|
|
|
trans('notifications.footer_reason_link', [], $language),
|
2023-08-15 21:39:39 +08:00
|
|
|
);
|
|
|
|
}
|
2023-08-04 19:27:29 +08:00
|
|
|
}
|