Last active
January 14, 2016 20:01
-
-
Save MichalGallovic/f9e8bf501c8175ee828d to your computer and use it in GitHub Desktop.
Laravel 5.x - refresh compiled classmap
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; | |
/* | |
* Add this to $commands array | |
* in App\Console\Kernel | |
* | |
* http://stackoverflow.com/questions/30819934/laravel-migrations-class-not-found | |
*/ | |
class RefreshCompiledClassmap extends Command | |
{ | |
/** | |
* The name and signature of the console command. | |
* | |
* @var string | |
*/ | |
protected $signature = 'migrate:compiled:refresh'; | |
/** | |
* The console command description. | |
* | |
* @var string | |
*/ | |
protected $description = 'Refresh compiled classmap'; | |
/** | |
* Create a new command instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
parent::__construct(); | |
} | |
/** | |
* Execute the console command. | |
* | |
* @return mixed | |
*/ | |
public function handle() | |
{ | |
// Clears all compiled files | |
$this->call('clear-compiled'); | |
// Updates autoload_psr4.php, Almost empties autoload_classmap.php | |
shell_exec("composer dump-autoload"); | |
// Updates autoload_classmap.php | |
$this->call('optimize'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment