PHP code example of techinasia / laravel-stream-notification-channel

1. Go to this page and download the library: Download techinasia/laravel-stream-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/ */

    

techinasia / laravel-stream-notification-channel example snippets

 php
NotificationChannels\GetStream\StreamServiceProvider::class
 bash
php artisan vendor:publish
 php
use NotificationChannels\GetStream\StreamChannel;
use NotificationChannels\GetStream\StreamMessage;
use Illuminate\Notifications\Notification;

class TestNotification extends Notification
{
    public function via($notifiable)
    {
        return [StreamChannel::class];
    }

    public function toStream($notifiable)
    {
        return (new StreamMessage())
            ->actor(1)
            ->verb('like')
            ->object(3)
            ->foreignId('post:42');
    }
}
 php
/**
 * Notification routing information for Stream.
 *
 * @return array
 */
public function routeNotificationForStream()
{
    return [
        'type' => 'user',
        'id' => $this->id,
    ];
}
 php
return (new StreamMessage())
    ->actor(1)
    ->verb('like')
    ->object(3);