use Illuminate\Notifications\Notification;
use NotificationChannels\Max\MaxChannel;
use NotificationChannels\Max\MaxMessage;
class InvoicePaid extends Notification
{
public function via($notifiable): array
{
return [MaxChannel::class];
}
public function toMax($notifiable): MaxMessage
{
return MaxMessage::create('Оплата получена')
->toUser($notifiable->max_user_id)
->markdown()
->button('Открыть счёт', 'https://example.com/invoice/1');
}
}
public function routeNotificationForMax(): int|array
{
return $this->max_user_id;
// или:
// return ['chat_id' => $this->max_chat_id];
}
use NotificationChannels\Max\MaxClient;
use NotificationChannels\Max\MaxMessage;
$message = MaxMessage::create('Здравствуйте!')
->toUser(12345)
->html();
$response = app(MaxClient::class)->sendMessage($message);