Wallogit.com
2017 © Pedro Peláez
Notifier is a laravel library that helps you to popup notifications to your registered users., (*1)
1- Jquery, (*2)
composer require carkii/notifier
in config\app.php, add notifier service provider :, (*3)
'providers' => [
/*
//
other providers
//
*/
Carkii\Notifier\NotifierServiceProvider::class,
]
and add aliase to same file:, (*4)
'aliases' => [
/*
//
other aliases
//
*/
'Notifier' => Carkii\Notifier\facades\Notifier::class,
]
publish the required files by typing php artisan vendor:publish in terminal., (*5)
This will add the following to your project:, (*6)
1- /config/notifier.php, (*7)
2- /resources/views/notifications/_cardExample.blade.php, (*8)
3- /resources/views/notifications/_ModalExample.blade.php, (*9)
4- /public/css/notifications.css, (*10)
5- /public/js/notifications.js, (*11)
notifications tablein your terminal, type : php artisan migrate, (*12)
Note: this library supposed that you already migrated the users table under users name in your database., (*13)
add CSRF_token to your head tag, add: php <meta name="csrf-token" content="{{ csrf_token() }}"> to your , (*14)
## 1- Modal (popup) 1- login in to your website, (*15)
2- add the following at the end of your page (default: app.blade.php):, (*16)
php
{!! Notifier::break(0,30,0)->get()->first() !!}
{!! Notifier::addStylesAndScriptes() !!}, (*17)
3- remove the first underscore (_) from /resources/views/notifications/_ModalExample.blade.php to be as /resources/views/notifications/ModalExample.blade.php. (this example is using bootstrap), (*18)
Note:, (*19)
- break($days,$hours,$minutes) is used to add a break time between notifications. - the first underscore of your notification file tells Notifier to ignore this file. - All of your notifications are located in ```/resources/views/notifications/```, each notification in each file (blade template) So, whenever you add a file to this folder, it means you are adding a new notification to your list.
4- visit your website :), (*20)
1- login in to your website, (*21)
2- add the following to your page (default: app.blade.php, recommended in navbar):, (*22)
```php
// get list of notifications and diaply them as a list
// navbar
//end of navbar, (*23)
//end of your page's body {!! Notifier::addStylesAndScriptes() !!} ```, (*24)
3- remove the first underscore (_) from /resources/views/notifications/_CardExample.blade.php to be as /resources/views/notifications/CardExample.blade.php. (this example is using bootstrap), (*25)
4- visit your website :), (*26)