PHP code example of kangkoding / laravel-notif-gowa

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

    

kangkoding / laravel-notif-gowa example snippets


// bootstrap/providers.php
[
    ...
    NotificationChannels\Waha\WahaServiceProvider::class,
],

// config/services.php
...
'waha' => [
    'apiUrl' => env('WAHA_API_URL'),
    'sessionId' => env('WAHA_SESSION_ID'),
    'apiKey' => env('WAHA_API_KEY'),
    'isEnable' => env('WAHA_ENABLE') ?? 0,
    'isDebug' => env('WAHA_DEBUG_ENABLE') ?? 0,
    'debugReceiveNumber' => env('WAHA_DEBUG_RECEIVE_NUMBER'),
],
...

use Illuminate\Notifications\Notification;
use NotificationChannels\Waha\GowaMessage;
use NotificationChannels\Waha\GowaChannel;

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

    public function toWaha($notifiable)
    {
        return GowaMessage::create("Task #{$notifiable->id} is complete!");
    }
}

public function routeNotificationForWaha()
{
    return $this->mobile; //depend what is your db field
}