Skip to content

Commit 45da308

Browse files
Add web_notification.header hook #4961 from Lars-/master
Add web_notification.header hook
2 parents 324d8d8 + 77e81c9 commit 45da308

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

app/Notifications/WebsiteNotification.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@ class WebsiteNotification extends Notification implements ShouldQueue
1919

2020
public $thread;
2121

22+
public $data;
23+
2224
/**
2325
* Create a new notification instance.
2426
*
2527
* @return void
2628
*/
27-
public function __construct($conversation, $thread)
29+
public function __construct($conversation, $thread, $data = [])
2830
{
2931
$this->conversation = $conversation;
3032
$this->thread = $thread;
33+
$this->data = $data;
3134
}
3235

3336
/**
@@ -54,6 +57,7 @@ public function toArray($user)
5457
return [
5558
'thread_id' => $this->thread->id,
5659
'conversation_id' => $this->conversation->id,
60+
'data' => $this->data,
5761
];
5862
}
5963

@@ -150,6 +154,7 @@ public static function fetchNotificationsData($notifications)
150154
'user' => $user,
151155
'created_by_user' => $created_by_user,
152156
'created_by_customer' => $created_by_customer,
157+
'data' => $notification->data['data'] ?? []
153158
];
154159
}
155160

resources/views/users/partials/web_notifications.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</div>
2727
<div class="web-notification-msg">
2828
<div class="web-notification-msg-header">
29-
{!! $web_notification_data['thread']->getActionDescription($web_notification_data['conversation']->number, true, Auth::user()) !!}
29+
{!! \Eventy::filter('web_notification.header', $web_notification_data['thread']->getActionDescription($web_notification_data['conversation']->number, true, Auth::user()), $web_notification_data) !!}
3030
</div>
3131
<div class="web-notification-msg-preview">
3232
{{ App\Misc\Helper::textPreview($web_notification_data['last_thread_body']) }}

0 commit comments

Comments
 (0)