Skip to content

Instantly share code, notes, and snippets.

@janzikmund
Last active April 21, 2018 09:40
Show Gist options
  • Save janzikmund/aa56f5e7b539e2e568e0739e836a980f to your computer and use it in GitHub Desktop.
Save janzikmund/aa56f5e7b539e2e568e0739e836a980f to your computer and use it in GitHub Desktop.
Laravel helper to output flash messages
{
"autoload": {
...
"files": [
"app/helpers.php"
]
}
}
@if(session()->has('flash_message'))
<div id="flash-message" class="status-{{ session('flash_message_status') }}">
{{ session('flash_message') }}
</div>
@endif
<?php
// /app/helpers.php:
function flash($message, $status = 'info') {
session()->flash('flash_message', $message);
session()->flash('flash_message_status', $status);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment