Help-me plx [controllers] [slim]


#1

I have a problem in my controller, inherit the class, controller with the following methods I will pass below, but I can not instance my route, because there are errors in container issues

I want to call three controllers here


#2

You are Wrong with architecture:

first add controller to container in dependencies.php:

$container['App\controllers\usuarioController'] = function ($container) {
    return new \App\controllers\usuarioController( $container );
};

Then route:

$app->get('/restrita', '\App\controllers\usuarioController:exibir');

In your exibir method will be:

public function exibir($request,$response) {
    $usuario = usuarios::all();
    $vars['usuarios'] = $usuario;

    $this->view->render($response,'restrita/index.phtml',$vars);
}