@php
    use Illuminate\Support\Facades\Storage;

    $itemClass = "ms-1 ms-lg-3";
    $btnClass = "btn btn-icon btn-icon-muted btn-active-light btn-active-color-primary w-30px h-30px w-md-40px h-md-40px";
    $userAvatarClass = "symbol-30px symbol-md-40px";
    $btnIconClass = "svg-icon-1";
@endphp

<!--begin::Toolbar wrapper-->
<div class="d-flex align-items-stretch flex-shrink-0">
    <!--begin::Search-->
    <!--begin::Menu wrapper-->
    <div class="d-flex align-items-center {{ $itemClass }}">
    <!--begin::Toggle-->
    <div class="d-flex align-items-center" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end">
        <div class="btn btn-icon btn-active-light-primary btn-custom">
            <i class="far fa-magnifying-glass"></i>
        </div>
    </div>
    <!--end::Toggle-->

    <!--begin::Menu-->
    <div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-800 menu-state-bg-light-primary fw-bold p-4 w-325px w-md-375px" data-kt-menu="true">
        <!--begin::Menu item-->
        <div class="menu-item p-2">
            <!--begin::Form-->
        <form action="{{ route('game.search') }}" method="GET" class="w-100 position-relative" autocomplete="off">
            <!--begin::Input group-->
            <div class="input-group @if (count($errors) > 0) is-invalid @endif">
                <span class="input-group-text" id="basic-addon1"><i class="fas fa-magnifying-glass"></i></span>
                <input type="text" class="form-control" name="search" placeholder="Search" maxlength="64" />
            </div>
            <!--end::Input group-->
            @if (count($errors) > 0)
                @foreach ($errors->all() as $error)
                <div class="invalid-feedback">{{ $error }}</div>
                @endforeach
            @endif
        </form>
        <!--end::Form-->
        </div>
        <!--end::Menu item-->


    </div>
    <!--end::Menu-->
</div>
<!--end::Dropdown wrapper-->


    <!--begin::Theme mode-->
    <div class="d-flex align-items-center {{ $itemClass }}">
        {{ theme()->getView('partials/theme-mode/_main', compact('btnClass')) }}
    </div>
    <!--end::Theme mode-->

    @if (Auth::check())
    <!--begin::User menu-->
    <div class="d-flex align-items-center ms-4 ms-lg-4" id="kt_header_user_menu_toggle">
        <!--begin::Menu wrapper-->
        <div class="cursor-pointer symbol {{ $userAvatarClass }}" data-kt-menu-trigger="click" data-kt-menu-attach="parent" data-kt-menu-placement="{{ (theme()->isRtl() ? "bottom-start" : "bottom-end") }}">
            <img src="{{ Storage::url('assets/avatars/') . auth()->user()->avatar }}" alt="user"/>
        @else
    <!--begin::User menu-->
    <div class="d-flex align-items-center ms-4 ms-lg-4 pulse pulse-success" id="kt_header_user_menu_toggle">
        <div class="cursor-pointer symbol {{ $userAvatarClass }}" data-kt-menu-trigger="click" data-kt-menu-attach="parent" data-kt-menu-placement="{{ (theme()->isRtl() ? "bottom-start" : "bottom-end") }}">
            <span class="pulse-ring border-4"></span>
            <img src="{{ Storage::url('assets/avatars/default.png') }}" />
            @endif
        </div>
        {{ theme()->getView('partials/topbar/_user-menu') }}
        <!--end::Menu wrapper-->
    </div>
    <!--end::User menu-->
</div>
<!--end::Toolbar wrapper-->
