Skip to content

Commit

Permalink
[ENH] Update app controller to extend the main base controller.
Browse files Browse the repository at this point in the history
  • Loading branch information
bim-g committed Jan 6, 2024
1 parent cb2f3f4 commit dc0c545
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
22 changes: 7 additions & 15 deletions controller/exampleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand Down
13 changes: 13 additions & 0 deletions src/Core/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@

namespace Wepesi\Core;

/**
*
*/
abstract class Controller
{
/**
* @var View
*/
protected View $view;

/**
*
*/
public function __construct(){
$this->view = new View();
}
}

0 comments on commit dc0c545

Please sign in to comment.