Skip to content

Instantly share code, notes, and snippets.

@Unicsoft01
Forked from james2doyle/notifications.blade.php
Created November 24, 2022 04:23
Show Gist options
  • Save Unicsoft01/76d123ac0adbd498fb198815addf140e to your computer and use it in GitHub Desktop.
Save Unicsoft01/76d123ac0adbd498fb198815addf140e to your computer and use it in GitHub Desktop.
Notification template for Sessions in Laravel. Assumes bootstrap and animate.css.
<div class="container">
<div class="row">
@if ($message = session()->get('success'))
<div class="animated fadeIn alert alert-success alert-dismissable">
<button type="button" class="close" aria-label="Close" data-dismiss="alert" aria-hidden="true">&times;</button>
<strong>Success:</strong> {!! $message !!}
</div>
{{ session()->forget('success') }}
@endif
@if ($message = session()->get('error'))
<div class="animated fadeIn alert alert-danger alert-dismissable">
<button type="button" class="close" aria-label="Close" data-dismiss="alert" aria-hidden="true">&times;</button>
<strong>Error:</strong> {!! $message !!}
</div>
{{ session()->forget('error') }}
@endif
@if (count($errors) > 0)
<div class="animated fadeIn alert alert-danger alert-dismissable">
<button type="button" class="close" aria-label="Close" data-dismiss="alert" aria-hidden="true">&times;</button>
<strong>Whoops! Something went wrong!</strong>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@if ($message = session()->get('warning'))
<div class="animated fadeIn alert alert-warning alert-dismissable">
<button type="button" class="close" aria-label="Close" data-dismiss="alert" aria-hidden="true">&times;</button>
<strong>Warning:</strong> {!! $message !!}
</div>
{{ session()->forget('warning') }}
@endif
@if ($message = session()->get('info'))
<div class="animated fadeIn alert alert-info alert-dismissable">
<button type="button" class="close" aria-label="Close" data-dismiss="alert" aria-hidden="true">&times;</button>
<strong>Info:</strong> {!! $message !!}
</div>
{{ session()->forget('info') }}
@endif
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment