1. Go to this page and download the library: Download alfa6661/laravel-firebase 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/ */
public function routeNotificationForFirebase()
{
return ["DEVICE_TOKEN", "DEVICE_TOKEN"];
}
php
use Alfa6661\Firebase\FirebaseChannel;
use Alfa6661\Firebase\FirebaseMessage;
use Illuminate\Notifications\Notification;
class CreditWasCreated extends Notification
{
public function via($notifiable)
{
return [FirebaseChannel::class];
}
public function toFirebase($notifiable)
{
return FirebaseMessage::create()
->title('Title')
->body('Push notification body')
->data(['id' => $notifiable->id]);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.