var $route to Auth controller |
Hello everyone,
sorry for that silly question but i'm new to CodeIgniter. I Use CodeIgniter 3 and Ion Auth. I would like to know the best way to share the variable $route['default_controller'] in /application/config/routes.php to /application/controllers/Auth.php in public function login() for redirect('/','refresh'). I did not find information on how to share this type of data in the documentation. I suppose it is possible to go through the global session variable but it is not very clean I think, and I do not know where to set it (in routes.php)? CodeIgniter being in MVC should I suppose pass the variable routes via the function __construct () of the controllers Auth.php? But I don't know where to initialize the controller when loading ... can you help me? Thanks for your help Ok I find the good way I think. Auth is extends CI_Controller and I can access to $this parameters. with print_r($this), I can find my parameter $this->router->default_controller. And I can directly use it in my auth Controller. Code: redirect('/'.$this->router->default_controller, 'refresh'); I have other question. If I need add new global parameters to $this is it possible ? Where I the best to do that ? And how ? |
Messages In This Thread |
var $route to Auth controller - by nicolas33770 - 02-14-2020, 08:54 AM
RE: var $route to Auth controller - by dave friend - 02-14-2020, 03:45 PM
RE: var $route to Auth controller - by nicolas33770 - 02-16-2020, 11:23 AM
RE: var $route to Auth controller - by dave friend - 02-17-2020, 08:04 AM
RE: var $route to Auth controller - by nicolas33770 - 02-17-2020, 01:28 PM
|