forked from eatvio/eatvio-infra
45 lines
1.0 KiB
PHP
45 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class DietStarted extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public object $chosenDiet;
|
|
|
|
/**
|
|
* Create a new notification instance.
|
|
*/
|
|
public function __construct(object $chosenDiet)
|
|
{
|
|
$this->afterCommit();
|
|
$this->chosenDiet = $chosenDiet;
|
|
}
|
|
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['mail'];
|
|
}
|
|
|
|
public function toMail(object $notifiable): MailMessage
|
|
{
|
|
return (new MailMessage())
|
|
->line('you are successful started diet named: '.$this->chosenDiet->diet->name)
|
|
->action('Notification Action', route('diet.show', $this->chosenDiet->diet))
|
|
->line('Thank you for using our application!');
|
|
}
|
|
|
|
public function toArray(object $notifiable): array
|
|
{
|
|
return [
|
|
|
|
];
|
|
}
|
|
}
|