Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 11 |
| ArticlesNotification | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 11 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| via | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| toMail | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 7 |
|||
| toDatabase | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| <?php | |
| namespace App\Notifications; | |
| use Illuminate\Bus\Queueable; | |
| use Illuminate\Contracts\Queue\ShouldQueue; | |
| use Illuminate\Notifications\Messages\MailMessage; | |
| use Illuminate\Notifications\Notification; | |
| class ArticlesNotification extends Notification | |
| { | |
| use Queueable; | |
| private $details; | |
| /** | |
| * Create a new notification instance. | |
| * | |
| * @param array => The details of the notification | |
| * @return void | |
| */ | |
| public function __construct($details) | |
| { | |
| $this->details = $details; | |
| } | |
| /** | |
| * Get the notification's delivery channels. | |
| * | |
| * @param mixed $notifiable | |
| * @return array | |
| */ | |
| public function via($notifiable) | |
| { | |
| // return ['database']; | |
| return ['mail','database']; | |
| } | |
| /** | |
| * Get the mail representation of the notification. | |
| * | |
| * @param mixed $notifiable | |
| * @return \Illuminate\Notifications\Messages\MailMessage | |
| */ | |
| public function toMail($notifiable) | |
| { | |
| return (new MailMessage) | |
| ->from('mahmoudgz2003@gmail.com') | |
| ->subject($this->details['subject']) | |
| ->greeting($this->details['greeting']) | |
| ->line($this->details['body']) | |
| ->action($this->details['actionText'], $this->details['actionURL']) | |
| ->line($this->details['thanks']); | |
| } | |
| /** | |
| * Get the array representation of the notification. | |
| * | |
| * @param mixed $notifiable | |
| * @return array | |
| */ | |
| // public function toArray($notifiable) | |
| public function toDatabase ($notifiable) | |
| { | |
| return [ | |
| 'article_id' => $this->details['article_id'] | |
| ]; | |
| } | |
| } |