PHP code example of gaaarfild / laravel-notifications

1. Go to this page and download the library: Download gaaarfild/laravel-notifications 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/ */

    

gaaarfild / laravel-notifications example snippets

 PHP
'providers' => [
    // ...
    Garf\LaravelNotifications\LaravelNotificationsServiceProvider::class,
]
 PHP
'aliases' => [
    // ...
  'Notifications' => Garf\LaravelNotifications\NotificationsFacade::class,
]
 php
Notifications::add('Your message text', 'type', 'group');
 PHP
Notifications::byType('warning')->get();
 PHP

    public function formatErrors(Validator $validator){
        foreach ($validator->errors()->all() as $error) {
            Notifications::add($error, 'danger');
        }

        return $validator->errors()->getMessages();
    }