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 { public function handle($request, Closure $next) { if (env('APP_DEBUG') || env('APP_ENV') === 'local') Artisan::call('view:clear'); return $next($request); } }
Mike Henken Jul 26 '16 at 19:32 2016-07-26 19:32
source share