Laravel use / route for both logged and non logged user

I’m using facebook as login and I’m expecting the route to know if the root is logged in or not to use the main URL both as user ‘dashboard’ as the guests main page with a facebook login button. Much like facebook itself (that keeps as URL after login).

I’m unable to get my code to work so here goes a somehow pseudo code:

Route::get('/', function () {
    if (Auth::check()) {
        Route::group(['middleware' => 'hasuserkind'], function() {                
            route::get('/', 'MemberController@dashBoard');
    } else {
        return View::make('landing'); 

Not only I wanna call that MemberController@dashBoard function, but I also wanna get that middleware to get called first. How should I do this?

Source: laravel

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.