PHP code example of codezero / laravel-flash

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

    

codezero / laravel-flash example snippets


flash()->success('Update succeeded!');

flash()->info('info message');
flash()->success('success message');
flash()->warning('warning message');
flash()->error('error message');

flash()->notification('message', 'level');

// use 'resources/views/custom.blade.php' instead of
// 'resources/views/vendor/flash/notifications/success.blade.php'
flash()->success('message')->setView('custom');



namespace App;

use CodeZero\Flash\BaseFlash;

class YourCustomFlash extends BaseFlash
{
    /**
     * Flash a notification.
     *
     * @param string $message
     *
     * @return \CodeZero\Flash\Notification
     */
    public function danger($message)
    {
        return $this->notification($message, 'danger');
    }
}

public function register()
{
    $this->app->bind('flash', \App\YourCustomFlash::class);
}
bash
php artisan vendor:publish --provider="CodeZero\Flash\FlashServiceProvider" --tag="views"
bash
php artisan vendor:publish --provider="CodeZero\Flash\FlashServiceProvider" --tag="config"