laravel disable blade cache
<?php
return [
'cache' => false,
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];
Inside of your app/config/view.php
file you'll want to set 'cache' => false,
, this will disable your view caching and can come in handy when you are building some blade directives or developing a Laravel package.
Optionally, if you want to disable caches for specific environments (say: production and staging), you could do something like this:
'cache' => in_array(App::environment(), ['production', 'staging']),
That's all there is to it. Hope you find this useful :)
Here is what the above code is doing:
1. We create a new ViewServiceProvider and pass in the path to our views (and the cache path is set to false).
2. We create a new BladeServiceProvider and pass in the path to our compiled views.
3. We create a new AppServiceProvider and pass