{{--  Validation errors --}}
@if($errors->any())
    @foreach ($errors->all() as $error)
        <script>
            require(['jquery', 'Noty'], function ($, Noty) {
                $(function () {
                    new Noty({
                        type: "error",
                        layout: "topRight",
                        text: "{{ $error }}",
                        theme: "sunset",
                        timeout: 2500,
                        closeWith: ["click", "button"]
                    }).show();
                });
            });
        </script>
    @endforeach
@endif

{{--  Http request alerts --}}
@if(session()->has("alert"))
    <script>
        require(['jquery', 'Noty'], function ($, Noty) {
            $(function () {
                new Noty({
                    type: "{{ session()->get("alert.type") }}",
                    layout: "topRight",
                    text: "{{ session()->get("alert.message") }}",
                    theme: "sunset",
                    timeout: 2500,
                    closeWith: ["click", "button"]
                }).show();
            });
        });
    </script>
@endif
