api/app/Notifications/HuntParticipantJoinedNotifi...

38 lines
1.0 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\Hunts;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class HuntParticipantJoinedNotification extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
public Hunts $hunt,
public User $participant,
) {}
/**
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject('Nouveau participant sur '.$this->hunt->title)
->greeting('Bonjour '.$notifiable->username)
->line($this->participant->username.' participe maintenant à votre chasse "'.$this->hunt->title.'".')
->line('Vous pouvez suivre les participants depuis votre espace organisateur.');
}
}