1. Go to this page and download the library: Download weelis/notification library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Weelis\Notification\Base\Notifiable;
use Weelis\Notification\Model\NotificationModel;
class User extends Authenticatable
{
use Notifiable, NotificationModel;
...
}
$request => ['os' => ' ' 'did' => ' '
FCM_API_KEY=legacy key
return [
/*
* Add the Firebase API key
*/
'fcm' => [
'api_key' => ''
],
];
public function via($notifiable)
{
return ['fcm'];
}
use Weelis\Notification\Apn\ApnMessage;
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return ['apn'];
}
public function toApn($notifiable)
{
return ApnMessage::create()
->badge(1)
->title('Account approved')
->body("Your {$notifiable->service} account was approved!");
}
}
public function routeNotificationForApn()
{
return $this->apn_token;
}
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return ['esms'];
}
public function toApn($notifiable)
{
return [
"sms" => <your sms message>
];
}
}
/**
* Route notifications for the FCM channel.
*
* @return string
*/
public function routeNotificationForEsms()
{
return $this->phone;
}