CasperSecurity
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use App\Models\AssignTenderActivity;
use App\Models\User;
use Illuminate\Notifications\Messages\BroadcastMessage;
class TenderActivityAssignToUser extends Notification implements ShouldQueue
{
use Queueable;
public $userinfo,$senderinfo,$assigntenderactivity;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct(AssignTenderActivity $assigntenderactivity,User $userinfo,User $senderinfo)
{
$this->userinfo=$userinfo;
$this->senderinfo=$senderinfo;
$this->assigntenderactivity=$assigntenderactivity;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail','database'];
//return ['mail','database','broadcast'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$userinfo=$this->userinfo;
$senderinfo=$this->senderinfo;
$assigntenderactivity=$this->assigntenderactivity;
$tenderactivity=$this->assigntenderactivity->getTenderActivity;
$tenderinfo=$this->assigntenderactivity->getCreateTender;
return (new MailMessage)->subject('Notification For Tender Activity Assigned by '.$userinfo->name)
->markdown('emails.tender.assign_tender_activity',compact('tenderinfo','userinfo','senderinfo','assigntenderactivity','tenderactivity'));
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'tender_activity_info'=>$this->assigntenderactivity,
'tender_activity'=>$this->assigntenderactivity->getTenderActivity,
'user_info'=>$this->userinfo,
];
}
/**
* Get the notification's database type.
*
* @return string
*/
public function databaseType(object $notifiable): string
{
return 'tender-activity-assign';
}
/* /**
* Get the broadcastable representation of the notification.
*/
public function toBroadcast($notifiable)
{
return new BroadcastMessage([
'tender_activity_info'=>$this->assigntenderactivity,
'tender_activity'=>$this->assigntenderactivity->getTenderActivity,
'user_info'=>$this->userinfo,
]);
}
}