In the PHP MVC I'm currently developing, the base controller checks if a user is logged in and, if so, updates its properties (see code).
Since these properties are used in various methods of model classes, I'd like to pass them from the base controller to the (base) model. What's the proper way of doing this?
class Controller {
protected $user_logged_in = false;
protected $logged_in_user_id = null;
function __construct() {
if(isset($_SESSION['user_id'])) {
$this->user_logged_in = true;
$this->logged_in_user_id = $_SESSION['user_id'];
}
}
}