PHP code example of molnix / laravel-nextcloud-talk-channel

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

    

molnix / laravel-nextcloud-talk-channel example snippets


// config/services.php
...
    'nextcloudtalk' => [
        'url' => env('NEXTCLOUD_URL'),
        'username' => env('NEXTCLOUD_USERNAME'),
        'password' => env('NEXTCLOUD_PASSWORD'),
        'default_channel' => env('NEXTCLOUD_DEFAULT_CHANNEL'),
        'one_to_one_channel_name' => env('NEXTCLOUD_ONE_TO_ONE_CHANNEL_NAME'),
    ],
...

use Illuminate\Notifications\Notification;
use Molnix\Channels\NextcloudTalkChannel;
use Molnix\Channels\NextcloudTalkMessage;

class NextcloudNotification extends Notification
{

    public function via(object $notifiable): array
    {
        return [NextcloudTalkChannel::class];
    }

    public function toNextcloudTalk()
    {
        return NextcloudTalkMessage::create('Hello');
    }

}

public function routeNotificationForNextcloudTalk($notification): string
    {
        return $this->username;
    }