This is a package for Laravel applications which enables you to send notifications through Camoo SMS Channel.
The package uses Camoo SMS Service to perform SMS dispatching.
This package can be installed via composer. Just type :
composer require undjike/camoo-laravel-notification-channel
After installation, configure your services in congig/services.php
by adding :
<?php
return [
//...
'camoo' => [
'key' => env('CAMOO_API_KEY'), // Your credentials
'secret' => env('CAMOO_SECRET_KEY')
],
];
Once this is done, you can create your notification as usual.
<?php
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use Undjike\CamooNotificationChannel\CamooChannel;
use Undjike\CamooNotificationChannel\CamooMessage;
class CamooNotification extends Notification
{
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [CamooChannel::class]; // or return 'camoo';
}
/**
* @param $notifiable
* @return mixed
*/
public function toCamoo($notifiable)
{
return CamooMessage::create()
->body('Type here you message content...')
->sender('Brand name');
// or return 'Type here you message content...';
}
}
To get this stuff completely working, you need to add this to your notifiable model.
/**
* Attribute to use when addressing Camoo SMS notification
*
* @returns string|array
*/
public function routeNotificationForCamoo()
{
return $this->phone_number; // Can be a string or an array of valid phone numbers
}
Enjoy !!!
The MIT License (MIT). Please see License File for more information.