Makes Laravel Notification a Breeze...
This package is custom notify for any model, so instead of using laravel notification. I built this custom notification package for my projects, so if you want to try it out read through the documentation.
The recommended way to install dev-techguy/note is through Composer.
# Install package via composer
composer require dev-techguy/noteNext, run the Composer command to install the latest stable version of dev-techguy/note:
# Update package via composer
composer require dev-techguy/note --lockAfter installing, the package will be auto discovered, But if need you may run:
# run for auto discovery <-- If the package is not detected automatically -->
composer dump-autoloadThen run this, to get the config/note.php for configurations:
# run this to get the configuartion file at config/note.php <-- read through it -->
php artisan vendor:publish --provider="Note\NoteServiceProvider"You will have to provide this in the .env for the api configurations:
# This is the pagination number you want to paginate with <-- default(10) -->NOTE_NOTIFICATION_PAGINATE=
# set all the guards to use within the systemSYSTEM_GUARDS=admin,webFollow the steps below on how to use the package:
# On the relating model usepublicfunctionnotification(){
return#the relationship
}useNote\Note;
/** * Create a new controller instance. * * @return void */publicfunction__construct() {
//The instance should be your guard either admin,auth on so on.
}
/** * --------------------------------- * Read a notification. * --------------------------------- */publicfunctionreadNotification() {
Note::readNotification(PassNotificationID);//Pass notification model id.
}
/** * --------------------------------- * Read a trashed notification. * --------------------------------- */publicfunctionreadTrashedNotification() {
Note::readTrashedNotification(PassNotificationID);//Pass notification model id.
}
/** * --------------------------------- * Fetch Latest Notification Here * --------------------------------- */publicfunctionlatestNotifications() {
Note::latestNotifications();
}
/** * -------------------------------- * Fetching all notifications * -------------------------------- */publicfunctionallNotifications() {
Note::allNotifications();
}
/** * -------------------------------- * Fetching all unread notifications * -------------------------------- */publicfunctionunreadNotifications() {
Note::unreadNotifications();
}
/** * =------------------------------- * Deleting a single notification * ------------------------------------------------------------------------------ * To achieve single notification create a route that receives a (string) notification_id * Note that this package uses uuids so the notification_id has to be a string * ---------------------------------------------------------------------------------------- */publicfunctiondeleteSingleNotification(string$notification_id) {
Note::deleteSingleNotification($notification_id);//Pass notification model id.
}
/** * =------------------------------- * Deleting a trashed notification * ------------------------------------------------------------------------------ * To achieve single notification create a route that receives a (string) notification_id * Note that this package uses uuids so the notification_id has to be a string * ---------------------------------------------------------------------------------------- */publicfunctiondeleteTrashedNotification(string$notification_id) {
Note::deleteTrashNotification($notification_id);//Pass notification model id.
}
/** * =------------------------------- * Deleting a all notification * -------------------------------- */publicfunctiondeleteAllNotifications() {
Note::deleteAllNotifications();
}
/** * -------------------------------------- * Fetch the trashed notifications here * -------------------------------------- */publicfunctiontrashedNotifications(){
Note::trashedNotifications();
}
/** * ------------------------------------------ * Clear all the trashed notifications here * ----------------------------------------- */publicfunctionclearTrashedNotifications(){
Note::clearTrashedNotifications();
}
/** * -------------------------------- * Creating new notification here * -------------------------------- * In creating notification we need 4 parameters are required * ------------------------------------------------------------------------------------------------------- */publicfunctioncreateSystemNotification() {
//This is for creating user notifications
Note::createSystemNotification('This will be the Model class i.e App\User','My Notification Subject', 'My Notification Message');
}
/** * --------------------------- * TODO SIMPLE PACKAGE NOTES * ----------------------------------------------------------------------------------------- * For the functions used above can be changed to your own names to call the package names * ----------------------------------------------------------------------------------------- */| Version | Status | Packagist | Namespace | Repo |
|---|---|---|---|---|
| 1.x | Latest | dev-techguy/note | Note/NoteServiceProvider | v1.0.1 |
For any security vulnerabilities, please email to TechGuy.
This package is open-source software licensed under the MIT license.