namespace App\Notifications;
use Illuminate\Notifications\Notification;
use AylesSoftware\MessageMedia\MessageMediaChannel;
use AylesSoftware\MessageMedia\MessageMediaMessage;
class SmsTest extends Notification
{
public function __construct(public string $token)
{
}
public function via($notifiable)
{
return [MessageMediaChannel::class];
}
public function toMessageMedia($notifiable)
{
return (new MessageMediaMessage)
->message("SMS test to user #{$notifiable->id} with token {$this->token} by MessageMedia")
->from('Dory');
// setting a delay when the sms should be sent
return (new MessageMediaMessage)
->message("SMS test to user #{$notifiable->id} with token {$this->token} by MessageMedia")
->from('Dory')
->delay(now()->addHours(6));
}
}
public function routeNotificationForMessageMedia()
{
return $this->phone;
}