aizhar777/laravel_mobizon

Mobizon Notifications channel for Laravel

0.1.2 2018-04-29 13:56 UTC

This package is not auto-updated.

Last update: 2024-04-23 01:50:40 UTC


README

This package makes it easy to send notifications using mobizon.kz with Laravel.

Installation

You can install the package via composer:

composer require aizhar777/laravel_mobizon

Publish the configs:

php artisan vendor:publish --provider="Aizhar777\Mobizon\MobizonServiceProvider"

Then you must install the service provider:

// config/app.php
'providers' => [
    ...
    Aizhar777\Mobizon\MobizonServiceProvider::class,
],

Install your Api key in the config:

// config/mobizon.php
return [
    'alphaname' => null,
    'secret' => 'Your secret API key',
];

Usage

You can use the channel in your via() method inside the notification:

use Illuminate\Notifications\Notification;
use Aizhar777\Mobizon\MobizonMessage;
use Aizhar777\Mobizon\MobizonChanel;

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

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

In your notifiable model, make sure to include a routeNotificationForMobizon() method, which return the phone number.

public function routeNotificationForMobizon()
{
    return $this->phone;
}