RFFRED
5 months ago
397
1
Laravel

How to access a custom module variable

Posted 5 months ago by RFFRED

Hi,

I have a custom module with variable

class MyTestProvider extends ServiceProvider
{
	public protected $module_name = "my-test";

In this very same service provider, I have controllers. How can my controller access the $module_name variable??

I tried to add in my controller constructor

print \Test\MyTestProvider::module_name;

but that does not work. It is looking for a constant which my variable is not...

Not sure what to do...

Please sign in or create an account to participate in this conversation.