CasperSecurity
<?php
namespace App\Notifications;
use App\Models\CreateTender;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\BroadcastMessage;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class TenderAssignToUser extends Notification implements ShouldQueue
{
use Queueable;
public $tenderinfo,$userinfo,$senderinfo;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct(CreateTender $tenderinfo,User $userinfo,User $senderinfo)
{
$this->tenderinfo=$tenderinfo;
$this->userinfo=$userinfo;
$this->senderinfo=$senderinfo;
}
/**
* 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)
{
$tenderinfo=$this->tenderinfo;
$userinfo=$this->userinfo;
$senderinfo=$this->senderinfo;
return (new MailMessage)->subject('Notification For Tender Assigned by '.$userinfo->name)->markdown('emails.tender.assign_tender',compact('tenderinfo','userinfo','senderinfo'));
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'tender_info'=>$this->tenderinfo,
'user_info'=>$this->userinfo,
];
}
/**
* Get the notification's database type.
*
* @return string
*/
public function databaseType(object $notifiable): string
{
return 'tender-assign';
}
/* /**
* Get the broadcastable representation of the notification.
*/
public function toBroadcast($notifiable)
{
return new BroadcastMessage([
'tender_info'=>$this->tenderinfo,
'user_info'=>$this->userinfo,
]);
}
}