This package makes it easy to send notifications using redsms.ru with Laravel 5.3+.
You can install the package via composer:
composer require laravel-notification-channels/redsms-ru
Then you must install the service provider:
// config/app.php
'providers' => [
...
NotificationChannels\RedsmsRu\RedsmsRuServiceProvider::class,
],
Add your RedsmsRu login, API key (hashed password) and default sender name to your config/services.php
:
// config/services.php
...
'redsmsru' => [
'login' => env('REDSMSRU_LOGIN'),
'secret' => env('REDSMSRU_SECRET'),
'sender' => env('REDSMSRU_SENDER')
],
...
You can use the channel in your via()
method inside the notification:
use Illuminate\Notifications\Notification;
use NotificationChannels\RedsmsRu\RedsmsRuMessage;
use NotificationChannels\RedsmsRu\RedsmsRuChannel;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [RedsmsRuChannel::class];
}
public function toRedsmsRu($notifiable)
{
return new RedsmsRuMessage("Task #{$notifiable->id} is complete!");
}
}
In your notifiable model, make sure to include a routeNotificationForRedsmsru() method, which return the phone number.
public function routeNotificationForRedsmsru()
{
return $this->phone;
}
text()
: Set a text of the notification message.
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email kindly1987@gmail.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.