I am getting the views folder path with this: app_path()."/Views"
Is there any better or more solid way of getting the views folder path? I mean, just in case the view folder is moved to somewhere else and it still works.
Thanks.
Yes I guess it's possible to make it more prone to change. Just get it from the config like so:
Config::get('view.paths');
This is actually an array of paths (folders) for your views. To change it, just look at the /app/config/view.php config file. It should be quite self-explanatory from there.
If you can access $this->app somehow (e.g. in a ServiceProvider), you also can obtain the configured paths by doing:
$this->app['config']['view.paths']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With