Last active
August 1, 2019 21:17
-
-
Save cjonstrup/8228165 to your computer and use it in GitHub Desktop.
Clear Laravel 4.* app/storage/views artisan views:clear
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Console\Command; | |
use Illuminate\Filesystem\Filesystem; | |
class ViewsCommand extends Command { | |
/** | |
* The console command name. | |
* | |
* @var string | |
*/ | |
protected $name = 'views:clear'; | |
/** | |
* The console command description. | |
* | |
* @var string | |
*/ | |
protected $description = 'Clear views folder'; | |
/** | |
* The file system instance. | |
* | |
* @var \Illuminate\Filesystem\Filesystem | |
*/ | |
protected $files; | |
/** | |
* Create a new command instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
parent::__construct(); | |
$this->files = new \Illuminate\Filesystem\Filesystem; | |
} | |
/** | |
* Execute the console command. | |
* | |
* @return mixed | |
*/ | |
public function fire() | |
{ | |
foreach ($this->files->files(storage_path().'/views') as $file) | |
{ | |
$this->files->delete($file); | |
} | |
$this->info('Views deleted from cache'); | |
} | |
} |
2bj
commented
Aug 1, 2019
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment