Config Static Variables Not Working |
Thanks. I think I know now.
1. You are not defining the $config in your BaseController. This means you are dynamically creating the property. Why is this a problem? First, when you call $this->config on BaseController you are basically creating it on the fly on that class. However, when you call $this->config on Admin the config is created anew because it is not there to begin with. So you need to define the config explicitly. PHP Code: class BaseController 2. Next, it seems you are only using static properties and methods in your config. Since these static members belong to the class, you can skip instantiating it using config(). Instead, you can directly invoke the statics from the class itself. PHP Code: # instead of calling like this proof that this works https://3v4l.org/cXDLX For #2 please note that the ::class notation should only be used as solution if strictly all properties and methods are static. If there's at least one that is not, you should use the config function |
Welcome Guest, Not a member yet? Register Sign In |