Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

alogixsolutions's avatar

Home page Authentication Issue

I am facing a problem I want to access home page for all users, but this home page is not accessible when I am using this middleware

$this->middleware('auth:user');

It is redirecting me towards login page.

I also tried by using it

$this->middleware('auth:user', ['except' => ['index', 'home']]);

but in this way on blade file only login option is appearing in user logged in state but Logout option and profile link is not appearing

Anyway please help me regarding it.

Thanks

0 likes
2 replies
jlrdw's avatar

What version of laravel.

Is this fortify or UI.

When you say:

I want to access home page for all users

Do you mean you access as admin, or users can't currently access their home page?

I have never had to modify any middleware for authentication and authorization. I do have protected routes:

Route::middleware(['auth'])->group(function () {
//  routes requiring login

Then use authorization to determine what the logged in user can or cannot do.

Again you shouldn't have to modify any middleware, out of box Auth scaffolding works when authorization is implemented.

alogixsolutions's avatar

It has been done through

Route::middleware('auth:user')->group(function () { Route::get('/', 'HomeController@home'); Route::get('/home', 'HomeController@index'); });

Route::middleware('guest')->group(function () { Route::get('/', 'HomeController@home'); Route::get('/home', 'HomeController@index'); });

Now home page is accessing for registered and non registered users by creating separate routes for both types of users.

Please or to participate in this conversation.