i'm new to laravel, i had installed auth scaffold, here is the route up to now.
Route::group(['middleware' => ['web']], function () {
Route::auth();
Route::get('/home', 'HomeController@index');
Route::get('addthreadhtml', function()
{
return View::make('addThreadForm');
});
Route::post('thread/add', 'ThreadController@addthread');
Route::get('thread/showall', 'ThreadController@showallthread');
});
i want to protect addthreadhtml from non-authenticated user access, if the user don't login, they will be redirected to another view.
How can i do that?
Add the auth middleware to the route you want to protect:
Route::get('addthreadhtml', ['middleware' => 'auth', function () {
return View::make('addThreadForm');
}]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With