PHP code example of hajtuj / laravel-flash-messages

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

    

hajtuj / laravel-flash-messages example snippets


public function store() {
    return redirect('/')->successMsg('Your message');
}

public function store() {
    return back()->successMsg('Your message');
}

public function store() {
    flash('message', 'info');
    return back();
}

public function store() {
    flash('message')->success();
    return back();
}

public function store(FlashMessageContract $flash) {
    $flash->flashMessage('Hey! Successfully stored resource', 'success');
}

/**
 *  Types are used to name classes in html code of alerts
 */
'types' => ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'],

/**
* Class prefix and suffix is added to type of alert to create class name
*/
'class' => [
    'prefix' => 'alert-',
    'suffix' => '',
],
shell
$ php artisan flash-message:config
shell
$ php artisan flash-message:views