Package Data | |
---|---|
Maintainer Username: | Sbudah |
Maintainer Contact: | sibusiso@mbu.li (Sibusiso Mbuli) |
Package Create Date: | 2016-08-24 |
Package Last Update: | 2016-08-24 |
Home Page: | http://laravel-notification-channels.com/ |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-18 03:03:00 |
Package Statistics | |
---|---|
Total Downloads: | 26 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 1 |
Total Open Issues: | 0 |
This package makes it easy to send notifications using PanaceaMobile with Laravel 5.3.
You can install the package via composer:
composer require sbudah/panaceamobile
You must install the service provider:
// config/app.php
'providers' => [
...
NotificationChannels\PanaceaMobile\PanaceaMobileServiceProvider::class,
];
Create an account at Panacea Mobile and create an API token.
Add your PanaceaMobile login, secret key (hashed password) and default sender name to your config/services.php
:
// config/services.php
'panaceamobile' => [
'login' => env('PANACEAMOBILE_LOGIN'), // Your Username
'secret' => env('PANACEAMOBILE_SECRET'), // Your Token
'sender' => 'Sbudah' // Phone number to send SMS from
]
You can use the channel in your via()
method inside the notification:
use Illuminate\Notifications\Notification;
use NotificationChannels\PanaceaMobile\PanaceaMobileMessage;
use NotificationChannels\PanaceaMobile\PanaceaMobileChannel;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [PanaceaMobileChannel::class];
}
public function toPanaceaMobile($notifiable)
{
return (new PanaceaMobileMessage())
->content("Your {$notifiable->service} account was approved!");
}
}
In order to let your Notification know which phone are you sending/calling to, the channel will look for the phone_number
attribute of the Notifiable model. If you want to override this behaviour, add the routeNotificationForPanaceaMobile
method to your Notifiable model.
// app/User.php
public function routeNotificationForPanaceaMobile()
{
return '27111000101';
}
Example #2
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* Route notifications for the Nexmo channel.
*
* @return string
*/
public function routeNotificationForPanaceaMobile()
{
return $this->phone;
}
}
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.