Support the ongoing development of Laravel.io →
posted 10 years ago
Requests
Last updated 2 years ago.
0

The route

Route::resource('users', 'UserController');    

states, that the URL users/{parameter} is going to use show method in UserController. That is why, it is routing you there.

There is a mistake you made:

<a href='site.com/users/logout'>

is actually a GET request. You defined your logout route to listen to POST request

Route::post('/users/logout', ['as'=>'logout', 'uses'=>'UserController@logout'])

Change the route to GET, try if it helps

Last updated 2 years ago.
0

TorchSK:

Thanks, funny thing, that clicked in my head about 5 seconds before I read your reply. It's the 'ether' net, man... lol. One thing I had to change was that I had to define those routes ABOVE the resource - I forgot which order the hierarchy was. Problem solved :)

Last updated 2 years ago.
0

And did you change the route to logout to GET? Cause on second thought, it is not recomended to use GET for logout (although I am using it :)) )

Last updated 2 years ago.
0

I did... is there a better way?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Meowts meowts Joined 10 Jun 2014

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.

© 2024 Laravel.io - All rights reserved.