PHP code example of jralph / notification

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

    

jralph / notification example snippets



...
    'providers' => array(
        ...
        'Jralph\Notification\NotificationServiceProvider',
        ...
    ),
    ...
    'aliases' => array(
        ...
        'Notification' => 'Jralph\Notification\Facades\Notification'
        ...
    ),
...


    Notification::put('key', 'value');


    Notification::put('key', 'value');


    Notification::tags(['tag1', 'tag2'])->put('key', 'value');


    Notification::tag('tag1'); // Returns an array of all notifications tagged as `tag1`.



class AuthController extends BaseController {

    public function postLogin()
    {
        // Validate Form
        if ($validation->fails())
        {
            Notification::tags(['error'])->put('validation_failed', 'The form validation has failed.'); // Note you could pass an array as the value.
            return Redirect::back();
        }

        // Process User Login
    }

}

@foreach (Notification::tag('error') as $key => $notification)
    <div class="notification">
        <strong>{{ $key }}</strong> {{ $notification }}
    </div>
@endforeach