2018-03-26 05:50:48 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use App\Console\Command;
|
2019-09-13 20:05:02 +08:00
|
|
|
use Illuminate\Support\Facades\Artisan;
|
2018-03-26 05:50:48 +08:00
|
|
|
|
|
|
|
class ComposerCommand extends Command
|
|
|
|
{
|
|
|
|
protected $signature = 'phpvms:composer {cmd}';
|
|
|
|
protected $description = 'Composer related tasks';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Run composer update related commands
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
2018-08-27 00:40:04 +08:00
|
|
|
switch (trim($this->argument('cmd'))) {
|
2018-03-26 05:50:48 +08:00
|
|
|
case 'post-update':
|
|
|
|
$this->postUpdate();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$this->error('Command exists');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Any composer post update tasks
|
|
|
|
*/
|
|
|
|
protected function postUpdate(): void
|
|
|
|
{
|
|
|
|
if (config('app.env') === 'dev') {
|
2018-08-27 02:51:47 +08:00
|
|
|
/* @noinspection NestedPositiveIfStatementsInspection */
|
2018-03-26 05:50:48 +08:00
|
|
|
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
|
|
|
|
Artisan::call('ide-helper:generate');
|
|
|
|
Artisan::call('ide-helper:meta');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|