Welcome Guest, Not a member yet? Register   Sign In
Adding property in all Contrellers: MY_Controller vs BaseController
#4

(12-06-2018, 08:52 AM)Balenus Wrote: Good point, maybe I could even use

PHP Code:
$this->controller_url config_item('base_url' . static::class; 

in case I extend the controller, the late static binding would do the job and I wouldn't have to declare again in the extended class $this->controller_url = config_item('base_url')  . __CLASS__;  Wink

I use $this->router->class to avoid the confusion that the inheritance chain might cause and eliminate the need to redeclare in extended classes.  
Using $this->router->class should also by-pass problems that custom routes might introduce.
Reply


Messages In This Thread
RE: Adding property in all Contrellers: MY_Controller vs BaseController - by dave friend - 12-06-2018, 09:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB