Delete Laravel files to store / view on every reboot

I use a blade, which is great, but the reduction has to be recompiled and html files are created.

So, I need to figure out how to delete all the files in the repository views each time the page is reloaded at the design stage.

Any idea what light php code is and where to put it? In the base controller? in filers or routes.php?

Thanks for any idea. I am stuck and need some advice where to put the removal code, so it will not be deleted after the blade is compiled as an html file in the repository / views.

+2
php laravel
Jul 26 '16 at 17:03
source share
1 answer

If you are using PHP5 or higher, you can try the following. You can turn it on or off depending on the environment or debug mode is turned on.

<?php if (env('APP_DEBUG') || env('APP_ENV') === 'local') ini_set('opcache.revalidate_freq', '0'); 

You can also simply call the artisan command to clear the cache using the middleware or route filters.

Laravel 4

 <?php App::before(function($request) { if (env('APP_DEBUG') || env('APP_ENV') === 'local') Artisan::call('view:clear'); }); 

Laravel 5+ Middleware:

 <?php namespace App\Http\Middleware; use Artisan; use Closure; class ClearViewCache { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (env('APP_DEBUG') || env('APP_ENV') === 'local') Artisan::call('view:clear'); return $next($request); } } 
+3
Jul 26 '16 at 19:32
source share
— -



All Articles