Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save fsuuaas/93a678d9c7e1899908a09740cea35d2a to your computer and use it in GitHub Desktop.

Select an option

Save fsuuaas/93a678d9c7e1899908a09740cea35d2a 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
<script>
var Message = <?php echo json_encode($message); ?>;
toastr.options = {
"closeButton": true,
"debug": false,
"positionClass": "toast-bottom-right",
"timeOut": "0",
"extendedTimeOut": "0",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn"
}
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