PHP code example of thecodemill / flash-message

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

    

thecodemill / flash-message example snippets


use TheCodeMill\FlashMessage\Message;

$message = new Message('The problem with the gene pool is there’s no lifeguard', Message::STATUS_INFO);

use TheCodeMill\FlashMessage\Message;

// Info
$info = Message::info('I have noticed something strange.');

// Warning
$warning = Message::warning('This could be a problem.');

// Danger
$danger = Message::danger('Yes, it was definitely a problem.');

// Success
$success = Message::success('All fixed!');


Route::post('/submit', function () {
    // Do something
    // ...
    
    // Now redirect
    return redirect('/success')
        ->with('message', Message::success('Thanks for submitting.'));
});

@if($message = session('message'))
    <div class="alert alert-{{ strtolower($message->status()) }} alert-dismissible" role="alert">
    	<button type="button" class="close" data-dismiss="alert">
    		<span>&times;</span>
    		<span class="sr-only">Close</span>
    	</button>
    
        {{ $message->content() }}
    </div>
@endif