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

Can't you just use:

Route::get('/', ['as' => 'home', 'uses' => 'HomeController@guest']);

Route::group(['middleware' => 'auth'], function () {
    Route::get('/', ['as' => 'home', 'uses' => 'HomeController@auth']);
});
Last updated 9 years ago.
0

middle-ware

0

Do it in a Controller maybe?

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class HomeController extends Controller
{
    function __construct()
    {
        $this->middleware('auth', ['except' => 'getIndex']);
    }

    public function getIndex(Request $request)
    {
        if (Auth::guest()) {
            return view('welcome');
        }
        
        return view('dashboard');
    }
}
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.