Laravel Logout Form in Blade View

Published on Mar 28, 2022

After creating laravel new app, larave ui have default auth template. Here is the logout form 👇

<a class="dropdown-item" href="{{ route('logout') }}"
    onclick="event.preventDefault();
        document.getElementById('logout-form').submit();">
    {{ __('Logout') }}
</a>

<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
    @csrf
</form>