Forked from fridzema/laracasts flash message with toastr.js simple example
Last active
July 30, 2018 10:47
-
-
Save fsuuaas/93a678d9c7e1899908a09740cea35d2a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| @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