<link rel="stylesheet" href="{{ asset('assets/adminlte/plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css') }}">
<link rel="stylesheet" href="{{ asset('assets/adminlte/plugins/toastr/toastr.min.css') }}">
<script src="{{ asset('assets/adminlte/plugins/jquery/jquery.min.js') }}"></script>
<script src="{{ asset('assets/adminlte/plugins/sweetalert2/sweetalert2.min.js') }}"></script>
<script src="{{ asset('assets/adminlte/plugins/toastr/toastr.min.js') }}"></script>

@php
    $flashTypes = [
        'success' => 'success',
        'info' => 'info',
        'error' => 'error',
    ];
@endphp

@foreach ($flashTypes as $type => $toastrType)
    @if (Session::get($type, false))
        @php $data = Session::get($type); @endphp

        @if (is_array($data))
            @foreach ($data as $msg)
                <div class="alert alert-{{ $type }}" role="alert">
                    <i class="fa fa-{{ $type == 'error' ? 'times' : 'check' }}"></i>
                    {{ $msg }}
                </div>
            @endforeach
        @else
            <script>
                $(function () {
                    toastr.{{ $toastrType }}('{{ $data }}');
                });
            </script>
        @endif
    @endif
@endforeach
