diff --git a/controller/exampleController.php b/controller/exampleController.php index b63ab87..f3082d9 100644 --- a/controller/exampleController.php +++ b/controller/exampleController.php @@ -11,32 +11,24 @@ namespace Wepesi\Controller; -use Wepesi\Core\Application; +use Wepesi\Core\Controller; use Wepesi\Core\Http\Input; use Wepesi\Core\Http\Redirect; use Wepesi\Core\Session; -use Wepesi\Models\Message; -use Wepesi\Models\Roles; -use Wepesi\Models\Users; -class exampleController +class exampleController extends Controller { + public function __construct() + { + parent::__construct(); + } /** * @return void */ function home() { - $users = (new Users()) - ->include((new Message())) - ->include((new Roles()))->findAll(); - if (isset($users['exception'])){ - Application::dumper($users['exception']); - }else{ - Application::dumper($users[0]); - - } -// Redirect::to("/"); + $this->view->display('home'); } /** diff --git a/src/Core/Controller.php b/src/Core/Controller.php index 6f7536e..95c9911 100644 --- a/src/Core/Controller.php +++ b/src/Core/Controller.php @@ -5,7 +5,20 @@ namespace Wepesi\Core; +/** + * + */ abstract class Controller { + /** + * @var View + */ protected View $view; + + /** + * + */ + public function __construct(){ + $this->view = new View(); + } }