Installation
- Save the service account of your Firebase project to
credentials/firebase_credentials.json. - Enable the module and run
php artisan admin:migrate. - Schedule the sending command. Run a queue worker as well when you use instant notifications.
config/admin_helpers.php
routes/console.php
Notification model
Extend the package model and add the columns ofrelations:
app/Models/Notification/AppNotification.php
Notification types
Define the types in thenotificationsList() function of your project:
app/Utilities/helpers.php
Also define
getNotificationsTypes(), the list of types users can turn off in the app, and getPlatform(), the platform of the current request:
app/Utilities/helpers.php
User model
app/Models/User.php
device_tokens.
Add the Notification tokens tab to the user form with notificationsTokensTab():
app/Models/User.php
Creating notifications
Unknown types create nothing.
Notification center
app/Http/Controllers/NotificationController.php
onlyMine() returns notifications of the signed in user and the global ones. Each row contains id, type, data, read_at, title, message and created_at. Override the onlyMine and isNotPersistent scopes in your model to limit them further, e.g. by the app.
Testing
In thelocal and stagging environments, notifications are sent only to device tokens marked for debugging. Mark a token with the Allow notifications in DEV mode button in the notification tokens tab. New tokens are marked automatically in these environments.
Sending is logged into storage/logs/notification.log.