This package makes it easy to send app4less/reskyt push notifications with Laravel.
You can install the package via composer:
composer require webimpacto/laravel-app4less
First you must install the service provider (skip for Laravel>=5.5):
// config/app.php
'providers' => [
...
\Webimpacto\LaravelApp4Less\Providers\App4LessServiceProvider::class,
],
Launch artisan migrate, to create the Database Tables.
php artisan migrate
Add the \Webimpacto\LaravelApp4Less\Middleware\App4lessSaveToken middleware to web group in the Http Kernel, this will be store the tokens in App4less table.
// app/Http/Kernel.php
protected $middlewareGroups = [
...
\Webimpacto\LaravelApp4Less\Middleware\App4lessSaveToken::class
],
Set .env variables for you App user and App API KEY if you want to send Push Notifications
APP4LESS_USER=userapp
APP4LESS_APIKEY=user_api_key
Now you can use the channel in your via() method inside the notification as well as send a app4less push notification:
use Illuminate\Notifications\Notification;
use Webimpacto\LaravelApp4Less\Channel\App4LessPushChannel;
use Webimpacto\LaravelApp4Less\Channel\App4LessPushMessage;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [App4LessPushChannel::class];
}
public function toApp4LessPush($notifiable)
{
$user = User::find($this->friend->user_from);
return (new App4LessPushMessage)
->title('Notification Title')
->url('Notification URL')
->utm('UTM-Analytics');
}
}