I am working on a site that needs an admin panel. I'm currently trying to configure authentication for this panel, although I cannot find a way to deny access to any guest users (not administrators). Of course, I have a login page, and after logging in, it goes to the admin page, although you can also go to / admin when you are not logged in.
routes.php :
Route::get('home', function(){
if (Auth::guest()) {
return Redirect::to('/');
} else {
return Redirect::to('admin');
}
});
Route::get('admin', function () {
return view('pages.admin.start');
});
MainController.php :
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
class MainController extends Controller {
public function getIndex() {
return view('pages.index');
}
public function getAbout() {
return view('pages.about');
}
public function getPortfolio() {
return view('pages.portfolio');
}
public function getShop() {
return view('pages.shop');
}
public function getContact() {
return view('pages.contact');
}
}
I could really use some help here because I was completely stuck and yes, I read the documentation, although maybe I just missed something.