<?php
// * Option 1
Route::get('/admin', 'HomeController@index')->name('home')->middleware('auth');
// * Only viewable if NOT authenticated (ex. Sign Up page)
Route::get('/signup', 'HomeController@signup')->name('signup')->middleware('guest');
<?php
// ...
// ...
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth'); // * Option #2
// $this->middleware('auth')->only(['store', 'delete']); // Only to some routes
// $this->middleware('auth')->except(['store', 'delete']); // Apply to everything EXCEPT...
}
}