Files
futurewalker/app/Notifications/PostIncomplete.php

40 lines
819 B
PHP

<?php
namespace App\Notifications;
use App\Models\Post;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use NotificationChannels\Telegram\TelegramMessage;
class PostIncomplete extends Notification
{
use Queueable;
protected $post;
/**
* Create a new notification instance.
*/
public function __construct(Post $post)
{
$this->post = $post;
}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['telegram'];
}
public function toTelegram($notifiable)
{
return TelegramMessage::create()
->content("*Incomplete Post*:\nPost ID: ".$this->post->id."\nPost Name: ".$this->post->title);
}
}