I need to have a check for user validity on every page. Do I need a controller that checks this on every page or there is a simpler way of doing it? Do I need to create a base controller that is loaded each time?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That is how it usually is done. Just extend a base class which checks the validity on the before method.
Here is an example:
classes/controller/base.php:classes/controller/welcome.php:In the before method of the base controller, you can check the signed in user and permissions, and for example show an error message that they don’t have access to that page.