2019-11-20 23:16:01 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications\Messages;
|
|
|
|
|
2020-09-04 00:50:42 +08:00
|
|
|
use App\Contracts\Notification;
|
2019-11-20 23:16:01 +08:00
|
|
|
use App\Models\Pirep;
|
|
|
|
use App\Notifications\Channels\MailChannel;
|
2021-05-20 23:54:07 +08:00
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
2019-11-20 23:16:01 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send the PIREP accepted message to a particular user
|
|
|
|
*/
|
2021-05-20 23:54:07 +08:00
|
|
|
class PirepAccepted extends Notification implements ShouldQueue
|
2019-11-20 23:16:01 +08:00
|
|
|
{
|
2021-05-20 23:54:07 +08:00
|
|
|
use Queueable;
|
2019-11-20 23:16:01 +08:00
|
|
|
use MailChannel;
|
|
|
|
|
2020-05-09 23:31:25 +08:00
|
|
|
public $channels = ['mail'];
|
|
|
|
|
2019-11-20 23:16:01 +08:00
|
|
|
private $pirep;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new notification instance.
|
|
|
|
*
|
|
|
|
* @param \App\Models\Pirep $pirep
|
|
|
|
*/
|
|
|
|
public function __construct(Pirep $pirep)
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->pirep = $pirep;
|
|
|
|
|
|
|
|
$this->setMailable(
|
|
|
|
'PIREP Accepted!',
|
|
|
|
'notifications.mail.pirep.accepted',
|
|
|
|
['pirep' => $this->pirep]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the array representation of the notification.
|
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function toArray($notifiable)
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'pirep_id' => $this->pirep->id,
|
|
|
|
'user_id' => $this->pirep->user_id,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|