View depending on middleware

Posted 2 years ago by JhumanJ

Hello everybody, my name is Julien, and i'm new to Laracasts.

I want the view returned on my home page (route '/') to depend on the middleware.

Route::group(['middleware' => 'auth'], function () {

    Route::get('/', function () {
        return view('home');
    });

   ....

});

Route::group(['middleware' => 'guest'], function () {

    Route::get('/', function () {
        return view('welcome');
    });
    
.....
}); 

I tried this but it doesn't work... I also tried to use the Authcontroller to handle this, but it doesn't work either... Do you have any ideas? Thanks

Julien

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.