PHP code example of willishq / laravel5-flash

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

    

willishq / laravel5-flash example snippets


namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Willishq\Flash\Flash;

abstract class Controller extends BaseController {

	use DispatchesCommands, ValidatesRequests;
	/**
	 * @var Flash
	 */
	protected $flash;
	public function __construct(Flash $flash)
	{
		$this->flash = $flash;
	}
}

class FooController extends BaseController {

	public function somethingNeat()
	{
	    // epic codes
	    $this->flash->success('success message');
	    return redirect('/');
	}
}