Last active
October 30, 2015 21:25
-
-
Save whoacowboy/94ceae12f07431ac6ded to your computer and use it in GitHub Desktop.
Artisan command to clear all caches
This file contains hidden or 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 | |
namespace App\Console\Commands; | |
use Illuminate\Console\Command; | |
class Clear extends Command | |
{ | |
/** | |
* The name and signature of the console command. | |
* | |
* @var string | |
*/ | |
protected $signature = 'clear:caches'; | |
/** | |
* The console command description. | |
* | |
* @var string | |
*/ | |
protected $description = 'Clear all caches and remove compiled views.'; | |
/** | |
* Create a new command instance. | |
* | |
*/ | |
public function __construct() | |
{ | |
parent::__construct(); | |
} | |
/** | |
* Execute the console command. | |
* | |
* @return mixed | |
*/ | |
public function handle() | |
{ | |
$this->line('php artisan cache:clear'); | |
$this->comment('(Flush the application cache)'); | |
$this->call('cache:clear'); | |
$this->line('php artisan route:clear'); | |
$this->comment('(Remove the route cache file)'); | |
$this->call('route:clear'); | |
$this->line('php artisan clear-compiled'); | |
$this->comment('(Remove the compiled class file)'); | |
$this->call('clear-compiled'); | |
$this->line('php artisan config:clear'); | |
$this->comment('(Remove the configuration cache file)'); | |
$this->call('config:clear'); | |
$this->line('php artisan view:clear'); | |
$this->comment('(Clear all compiled view files)'); | |
$this->call('view:clear'); | |
$this->line('composer dump-autoload'); | |
exec('composer dump-autoload'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment