Set cache option in .env
This commit is contained in:
parent
2e08a63aa7
commit
40e64ef9b7
4 changed files with 18 additions and 7 deletions
2
.env
2
.env
|
@ -1,2 +0,0 @@
|
|||
DEBUG=true
|
||||
VIEW_CACHE=true
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
.idea
|
||||
.env
|
||||
storage/cache
|
||||
vendor
|
||||
|
||||
resources/cache
|
||||
.idea
|
|
@ -77,6 +77,14 @@ class BootstrapFactory {
|
|||
return "../resources/";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function storagePath()
|
||||
{
|
||||
return "../storage/";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ViewEngine
|
||||
*/
|
||||
|
|
|
@ -26,9 +26,13 @@ class ViewEngine extends AppFactory {
|
|||
{
|
||||
$loader = new FilesystemLoader(app()->resourcePath() . 'views');
|
||||
|
||||
self::$twig = new Environment($loader, [
|
||||
//'cache' => app()->resourcePath() . 'cache'
|
||||
]);
|
||||
$options = [];
|
||||
|
||||
if(env('cache')) {
|
||||
$options['cache'] = app()->storagePath() . 'cache';
|
||||
}
|
||||
|
||||
self::$twig = new Environment($loader, $options);
|
||||
|
||||
$this->loadHelperFunctions();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue