Add (initial): futurewalker code
This commit is contained in:
39
app/Notifications/PostIncomplete.php
Normal file
39
app/Notifications/PostIncomplete.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user