laravel - Clear views cache on Lumen -
few weeks ago, had same problem in laravel 5.1, solve this solution.
however, i'm facing same issue in lumen, can't call php artisan view:clear
clear cached files. there other way?
thanks!
there's no command view cache in lumen, can create own or use mini package found @ end of answer.
first, put file inside app/console/commands
folder (make sure change namespace if app has different app):
<?php namespace app\console\commands; use illuminate\console\command; class clearviewcache extends command { /** * name , signature of console command. * * @var string */ protected $name = 'view:clear'; /** * console command description. * * @var string */ protected $description = 'clear compiled view files.'; /** * create new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * execute console command. * * @return mixed */ public function handle() { $cachedviews = storage_path('/framework/views/'); $files = glob($cachedviews.'*'); foreach($files $file) { if(is_file($file)) { @unlink($file); } } } }
then open app/console/kernel.php
, put command inside $commands
array (again, mind namespace):
protected $commands = [ 'app\console\commands\clearviewcache' ];
you can verify worked running
php artisan
inside project's root.
you see newly created command:
you can run did in laravel.
edit
i've created small (mit) package this, can require composer:
composer require baao/clear-view-cache
then add
$app->register('baao\clearviewcache\clearviewcacheserviceprovider');
to bootsrap/app.php
, run
php artisan view:clear
Comments
Post a Comment