Support the ongoing development of Laravel.io →
Laravel Authentication Authorization

I just created a logout form then I created a route, in the controller I created a logout method and went straight to the home page, but why is it 404 not found?!!

Last updated by @zakiiii 1 year ago.

zakiiii liked this thread

1

Hi @zakiiii

Share more details about your problem including your web.php file.

0

I am using the following in my Menu Blade: Hopefully this will help with your issue:

                    <form method="POST" action="{{ route('logout') }}" x-data>
                        @csrf
                        <a href="{{ route('logout') }}"   @click.prevent="$root.submit();">
                            <button type="button" class="blah blah blah -- Use the class code you want.">
                                {{ __('Log Out') }}
                            </button>
                        </a>
                    </form>
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.