Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A facade root has not been set #36

Open
jon-hill-airangel opened this issue Jul 10, 2019 · 1 comment
Open

A facade root has not been set #36

jon-hill-airangel opened this issue Jul 10, 2019 · 1 comment

Comments

@jon-hill-airangel
Copy link

jon-hill-airangel commented Jul 10, 2019

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);
}

    } catch (\Exception $e){
        echo $e->getMessage();
        die;
    }
}

}

@jon-hill-airangel
Copy link
Author

Or is it possible to simply run straight from the template by bypassing the cache altogether?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant