Environment variables return null
m-ristau opened this issue · 2 comments
First of all: Thanks for this repository.
I had hard times to get the caching function to work.
Finally i figured out, it was a problem with my .env
variables.
According to this.
I temporarily fixed this by putting the .env variables in a seperate config file.
For example the function widgetShouldUseCache
in Imanghafoori\Widgets\Utils\Policies
:
env('WIDGET_CACHE')
returned here null
.
/**
* The caching is turned off when:
* 1- we are running tests
* 2- have disabled it in .env file.
*
* @return bool
*/
public function widgetShouldUseCache()
{
return (config('widget.cache') !== false) && (! app()->environment('testing'));
// return (env('WIDGET_CACHE', false) !== false) && (! app()->environment('testing'));
}
Maybe there is another problem on my side, otherwise i would suggest to implement publishing a seperate config file.
Laravel: 5.2.*
PHP: 7.0.4
I am happy you are enjoying my work.
Of course I my self had the same issue but I did not found why the env function is behaving like that.
I will fix it in the next minor release.
Thank you for reporting it.
Any other suggestion or issue is welome
@ristaumedia I hope you find the fix in 1.8.0 version.