PHP code example of guysolamour / laravel-callmebot
1. Go to this page and download the library: Download guysolamour/laravel-callmebot 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/ */
// in Notification file
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['cbwhatsapp']; // or ['Guysolamour\Callmebot\Channels\WhatsappChannel::class']
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toCbWhatsapp($notifiable)
{
return "Message ...";
}
// in Notifiable model
public function enableCallmebotNotification() :bool
{
return true;
}
public function routeNotificationForCbWHatsapp()
{
return 0102030405;
}
/**
* Get callmebot api keys
*
* @param string|null $client
* @return string|array
*/
public function callmebotApiKeys(?string $client = null)
{
$client_keys = [
'whatsapp' => 012345,
];
if (is_null($client)){
return $client_keys;
}
return Arr::get($client_keys, $client);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.