<?php
class Controller {
    public function __construct() {
        // nothing here
    }

    // load view file: path relative to app/view/
    public function display($view, $data = []) {
        // $view example: 'auth/login' => app/view/auth/login.php
        require_once __DIR__ . "/../view/" . $view . ".php";
    }

    // alias for backward compatibility: some controllers call view()
    public function view($view, $data = []) {
        $this->display($view, $data);
    }

    // load model: file name e.g. Login_model
    public function logic($model) {
        require_once __DIR__ . "/../model/" . $model . ".php";
        return new $model;
    }
}
?>
