public function __construct($app) { $user = $app->module('cockpit')->getUser(); if (!$user) { $app->reroute('/auth/login'); $app->stop(); } parent::__construct($app); $this->user = $app["user"] = $user; $this->db = $app->db; $controller = strtolower(str_replace('\\', '.', get_class($this))); $app->trigger("app.{$controller}.init", [$this]); }