1. Go to this page and download the library: Download valkovic/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/ */
flash('Message','success');
Flash()->success('Message');
flash()->success('Message'); //Note that flash() without parameters return Flash Model
// OR INSIDE CLASS
private $flash;
public function __construct(\Valkovic\Flash\Flash $flash) {
$this->flash = $flash;
}
public function send(User $user) {
//store User
$this->flash->success('Message');
}
flash('Message',['class'=>'myClass','id'=>'flashMessage']);
Flash()->message('Message',['class'=>'myClass','id'=>'flashMessage']);
//with template before will produce
<div class="notifications">
<div class="myClass" id="flashMessage">
Some message
</div>
</div>
html
<div class="notifications">
@foreach($flashes as $flash)
<div>
{{$flash->message}}
</div>
@endforeach
</div>