53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Modules\Crm\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Messages\BroadcastMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class PhoneListReminderNotification extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
public $phoneFollowUp;
|
|
|
|
public $body;
|
|
|
|
public function __construct($phoneFollowUp, string $body)
|
|
{
|
|
$this->phoneFollowUp = $phoneFollowUp;
|
|
$this->body = $body;
|
|
}
|
|
|
|
public function via($notifiable)
|
|
{
|
|
$channels = ['database'];
|
|
|
|
if (isPusherEnabled()) {
|
|
$channels[] = 'broadcast';
|
|
}
|
|
|
|
return $channels;
|
|
}
|
|
|
|
public function toArray($notifiable)
|
|
{
|
|
return [
|
|
'phone_follow_up_id' => $this->phoneFollowUp->id,
|
|
'business_id' => $this->phoneFollowUp->business_id,
|
|
'mobile_number' => $this->phoneFollowUp->mobile_number,
|
|
'body' => $this->body,
|
|
];
|
|
}
|
|
|
|
public function toBroadcast($notifiable)
|
|
{
|
|
return new BroadcastMessage([
|
|
'title' => __('crm::lang.phone_list'),
|
|
'body' => $this->body,
|
|
'link' => action([\Modules\Crm\Http\Controllers\PhoneListController::class, 'index']),
|
|
]);
|
|
}
|
|
}
|