Download the PHP package williamcruzme/laravel-notification-settings without Composer
On this page you can find all versions of the php package williamcruzme/laravel-notification-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download williamcruzme/laravel-notification-settings
More information about williamcruzme/laravel-notification-settings
Files in williamcruzme/laravel-notification-settings
Package laravel-notification-settings
Short Description A Laravel package that allows you to check the notification settings before send them.
License MIT
Informations about the package laravel-notification-settings
Laravel Notification Settings
laravel-notification-settings is a Laravel package that allows you to check the notification settings before send them.
- Installation
- Getting Started
- Usage
- Routes
- Customizing
💿 Installation
🏁 Getting Started
1. Adding trait
In your user model add the Notifiable
trait. This trait supports custom guards:
2. Running migrations
Sometimes you may need to customize the migrations. Using the vendor:publish
command you can export the migrations:
3. Creating seeder
Add all notifications that require settings. Notification that are not added will be sent without verification:
4. Adding routes
Using the Notification
facade to import the routes for manage the settings:
🚀 Usage
Using The Notifiable Trait
This trait contains one method that may be used to send notifications: notify
. The notify
method check if the user wants to receive it, and expects to receive a notification instance:
Using The Notification Facade
Alternatively, you may send notifications via the Notification
facade. This is useful primarily when you need to send a notification to multiple notifiable entities such as a collection of users. To send notifications using the facade, pass all of the notifiable entities and the notification instance to the send
method:
🌐 Routes
Get notifications
Method | URI |
---|---|
GET | /notifications |
Mark as read
Method | URI |
---|---|
PATCH | /notifications/read |
Delete notification
Method | URI |
---|---|
DELETE | /notifications/{notificationId} |
Get notification settings
Method | URI |
---|---|
GET | /settings/notifications |
Update notification setting
Method | URI |
---|---|
PATCH | /settings/notifications/{notificationTypeId} |
Body Params
🎨 Customizing
First of all, create your own NotificationSettingController
controllers and add the ManageNotificationSettings
trait.
Second, modify the namespace of the Notification
facade routes:
Custom request validations
The rules
validationErrorMessages
methods in the NotificationSettingController
allows you override the default request validations:
Custom response
The sendResponse
method in the NotificationSettingController
allows you override the default response:
Custom guards
The guard
method in the NotificationSettingController
allows you override the default guard:
🚸 Contributing
You are welcome to contribute to this project, but before you do, please make sure you read the contribution guide.
🔒 License
MIT