Support the ongoing development of Laravel.io →
posted 9 years ago
Authentication

My AuthController's redirectTo property:

    protected $redirectTo = '/';

Here is login routes:

Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');

Route::get('/admin', [
    'as' => 'admin',
    'uses' => 'Auth\AuthController@getLogin'
]);
Route::post('/admin', [
    'as' => 'admin',
    'uses' => 'Auth\AuthController@postLogin'
]);

When I first log in, it redirects me to localhost:8000 as supposed, but if I try to get localhost:8000/admin (which is login page) it redirects me to localhost:8000/home page.

I know that it's possible to redirect from /home, but I wonder why this happens?

Last updated 3 years ago.
0
Solution

Take a look at the \app\Http\Middleware\RedirectIfAuthenticated.php. Check this is middleware redirect after logging in.

Last updated 9 years ago.

enghusseinmansour liked this reply

1

Thank you very much!

You're the best!

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

4unkur 4unkur Joined 15 Aug 2015

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.