I need to be able to refresh the cache as we are having issues with old content being displayed in the browser after changes have been made and the page has been refreshed. I am aware of the Artisan::call('cache:clear') command. When I run this I get the error 'A facade root has not been set'
<?php
namespace App\Classes;
use Illuminate\Support\Facades\Artisan;
use Jenssegers\Blade\Blade as B; // the actual blade templating engine plugin
class Blade
{
/**
Needs to be included in every controller method where a view is included. sets blade plugin and template vars.
@param $view
@param $data
@param $run - will run or return template if true
@param $clearCache
*/
public static function run($view, $data, $run = true, $clearCache=false){
try{
// $blade = new B(BEDROCK_ROOT.'includes/v2/resources/views', BEDROCK_ROOT.'includes/v2/resources/cache');
$blade = new B(BEDROCK_ROOT.'includes/v2/resources/views', BEDROCK_ROOT.'includes/v2/resources/cache');
if($clearCache){
Artisan::call('clear:cache');
}
if($run){
echo $blade->make($view, $data);
exit;
} else {
return $blade->make($view, $data);
}
I need to be able to refresh the cache as we are having issues with old content being displayed in the browser after changes have been made and the page has been refreshed. I am aware of the Artisan::call('cache:clear') command. When I run this I get the error 'A facade root has not been set'
namespace App\Classes;
use Illuminate\Support\Facades\Artisan; use Jenssegers\Blade\Blade as B; // the actual blade templating engine plugin
class Blade { /**
@param $clearCache */ public static function run($view, $data, $run = true, $clearCache=false){ try{ // $blade = new B(BEDROCK_ROOT.'includes/v2/resources/views', BEDROCK_ROOT.'includes/v2/resources/cache'); $blade = new B(BEDROCK_ROOT.'includes/v2/resources/views', BEDROCK_ROOT.'includes/v2/resources/cache'); if($clearCache){ Artisan::call('clear:cache'); } if($run){ echo $blade->make($view, $data); exit; } else { return $blade->make($view, $data); }
} }