Can't you just use:
Route::get('/', ['as' => 'home', 'uses' => 'HomeController@guest']);
Route::group(['middleware' => 'auth'], function () {
Route::get('/', ['as' => 'home', 'uses' => 'HomeController@auth']);
});
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');
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community