Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fridzema/d8998b5dfaed82a8a71ef8c7201b03dd to your computer and use it in GitHub Desktop.
Save fridzema/d8998b5dfaed82a8a71ef8c7201b03dd to your computer and use it in GitHub Desktop.
@if(!is_null(session('flash_notification')))
@foreach ((array)session('flash_notification') as $message)
@php $message = (array)$message[0]; @endphp
@javascript([
'Message' => $message
])
<script>
toastr.options.closeButton = true;
toastr.options.progressBar = true;
toastr.options.timeOut = 2000;
if(Message.level == "success"){
toastr.success(Message.message);
}
if(Message.level == "info"){
toastr.info(Message.message);
}
if(Message.level == "warning"){
toastr.warning(Message.message);
}
if(Message.level == "danger"){
toastr.error(Message.message);
}
</script>
@endforeach
{{ session()->forget('flash_notification') }}
@endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment