PHP code example of justpush / laravel-notification-channel
1. Go to this page and download the library: Download justpush/laravel-notification-channel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
justpush / laravel-notification-channel example snippets
use Illuminate\Notifications\Notification;
use NotificationChannels\JustPush\JustPushChannel;
use NotificationChannels\JustPush\JustPushMessage;
class OrderShipped extends Notification
{
public function __construct(private Order $order) {}
public function via($notifiable): array
{
return [JustPushChannel::class]; // or ['justpush']
}
public function toJustPush($notifiable): JustPushMessage
{
return JustPushMessage::create("Order #{$this->order->number} is on its way")
->title('📦 Order shipped')
->topic('Orders')
->button('Track', $this->order->trackingUrl);
}
}
public function routeNotificationForJustPush($notification): ?string
{
return $this->justpush_token;
}