PHP code example of pascallieverse / laravel-bitrix24-notification

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

    

pascallieverse / laravel-bitrix24-notification example snippets


composer 

php artisan vendor:publish --provider="PascalLieverse\Bitrix24\Bitrix24ServiceProvider"



namespace App\Notifications;

use Illuminate\Notifications\Notification;
use PascalLieverse\Bitrix24\Bitrix24Channel;
use PascalLieverse\Bitrix24\Bitrix24Message;

class BitrixNotice extends Notification
{

    /**
     * Create a new notification instance.
     */
    public function __construct()
    {
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [Bitrix24Channel::class];
    }

    /**
     * Get the message.
     *
     * @param  mixed  $notifiable
     * @return Bitrix24Message
     */
    public function toBitrix24($notifiable)
    {
        return (new Bitrix24Message())->text("Bitrix notification message!");
    }
}

Notification::send(new Bitrix24Notifiable('1'), new BitrixNotice());

Notification::send(new Bitrix24Notifiable('chat1'), new BitrixNotice());