Laravel Js提示

@foreach(['success','error','danger','info'] as $msg)
    @if(session()->has($msg))
        <script>
            $(function () {
                $.toast("{{session()->get($msg)}}")
            })
        </script>
    @endif
@endforeach