PHP code example of balfour / laravel-flash-messages

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

    

balfour / laravel-flash-messages example snippets


use Balfour\LaravelFlashMessages\FlashMessages;

// resolve the message container
$flash = app(FlashMessages::class);

// or
$flash = app('flash');

// flash a message
$flash->flash('error', 'You are not authorized.');

// flash a message with a title
$flash->flash('error', 'You are not authorized.', 'Oopsie');

// add a message to the current container
// this message won't flash to the next request
$flash->add('error', 'You are not authorized.');

// retrieve all flash message
$messages = $flash->all();

// wipe all messages
$messages->clear();