PHP code example of laravel-notification-channels / bearychat

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

    

laravel-notification-channels / bearychat example snippets


ElfSundae\BearyChat\Laravel\ServiceProvider::class,



namespace App\Notifications;

use Illuminate\Notifications\Notification;
use NotificationChannels\BearyChat\BearyChatChannel;
use ElfSundae\BearyChat\Message;

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

    public function toBearyChat($notifiable)
    {
        return (new Message)
            ->text('foo')
            ->add('bar');
    }
}

public function toBearyChat($notifiable)
{
    return bearychat('admin')->text('New VIP has been paid!');
}

class User extends Authenticatable
{
    use Notifiable;

    public function routeNotificationForBearyChat()
    {
        return 'https://hook.bearychat.com/...';
    }
}

$message = (new Message)
    ->text('message content')
    ->notification('notification for this message')
    ->add('attachment content', 'attachment title', 'http://path/to/image', '#FF0000')
    ->to('@Boss');