@php
    /* @var \Illuminate\Support\Collection $messages */
    $messages = session('flash_notification', collect());
    $showAlerts = $messages->contains(function ($message) {
        return $message->overlay === false;
    });
    $showModals = $messages->contains(function ($message) {
        return $message->overlay === true;
    });
@endphp

@if($showModals)
    @each('flash::modal', $messages, 'message')

    @push('scripts')
        <script type="text/javascript">
          $('#flash-overlay-modal').modal();
        </script>
    @endpush
@endif

@if($showAlerts)
    @each('flash::alert', $messages, 'message')

    @push('scripts')
        <script type="text/javascript">
          $('div.alert.flash').not('.alert-important').delay(3000).fadeOut(350);
        </script>
    @endpush
@endif

{{ session()->forget('flash_notification') }}
