Base Controller
class MyBaseController extends Controller {
public function __construct()
{
if (Auth::check()) {
// The user is logged in...
}
else {
//Redirect to login page
}
}
}
Controller that will have database calling functions and will be available for logged in users only
class ChildController extends MyBaseController {
public function __construct()
{
parent::__construct();
}
}
What do I need ?
I want to check each request if that is made by an authenticated user ?
Question:
Is my approach correct or is this best practice to check if the call to this controller is made by authenticated user ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire