I needed a simple way to ensure a one off flash message would show to a user on some of my larval apps, so I used the following idea
I recall seeing this implemented in a few places, so nothing new, it is just using some self explanatory styling and the bulma.io library for css.
I did make a tailwindcss version which I will update and add later :)
0_o
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// put this as a partial in you app.blade.php | |
@if(session('global.flash')) | |
<section style="position: fixed; right: 1rem; top: 3.2rem; z-index: 999"> | |
<div class="tile is-ancestor" > | |
<div class="tile is-parent is-vertical"> | |
@foreach(session('global.flash') as key => notice) | |
<div class="tile is-child"> | |
<div class="notification is-{{$key}} animated fadeInDown" onclick="this.remove()"> | |
<span class="delete"></span> | |
{{ $notice }} | |
</div> | |
</div> | |
@endforeach | |
</div> | |
</div> | |
</section> | |
@endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* web.php | |
*/ | |
Route::get('/', function () { | |
session()->flash('setting.flash.success', 'Hello and Welcome to the App :)'); | |
return view('welcome'); | |
}); | |
I recall seeing this implemented in a few places, so nothing new, it is just using some self explanatory styling and the bulma.io library for css.
I did make a tailwindcss version which I will update and add later :)
0_o