PHP code example of prologue / alerts

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

    

prologue / alerts example snippets


'Prologue\Alerts\AlertsServiceProvider',

'Alert' => 'Prologue\Alerts\Facades\Alert',

Alert::add('error', 'Error message');

Alert::info('This is an info message.');
Alert::error('Whoops, something has gone wrong.');

// Add some alerts and flash them to the session.
Alert::success('You have successfully logged in')->flash();

// Redirect to the admin dashboard.
return Redirect::to('dashboard');

// Display the alerts in the admin dashboard view.
return View::make('dashboard')->with('alerts', Alert::all());

@foreach (Alert::all() as $alert)
    {{ $alert }}
@endforeach

@if (Alert::has('success'))
    {{ Alert::first('success') }}
@endif

@foreach (Alert::getMessages() as $type => $messages)
    @foreach ($messages as $message)
        <div class="alert alert-{{ $type }}">{{ $message }}</div>
    @endforeach
@endforeach

Alert::has(); // Will check for any alerts
Alert::has('error'); // Will check for any alerts listed as errors.

Alert::count(); // Will give you a total count of all alerts based on all levels within your alerts config.
Alert::count('error'); // Will tell you only the amount of errors and exclude any levels.
bash
$ php artisan vendor:publish --provider="Prologue\Alerts\AlertsServiceProvider"