Move helper generation to new command

This commit is contained in:
Nabeel Shahzad
2018-03-25 16:50:48 -05:00
parent 204f0b7a10
commit ca2f8e1aa5
4 changed files with 47 additions and 87 deletions

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Console\Commands;
use App\Console\Command;
use Artisan;
/**
* Class ComposerCommand
* @package App\Console\Commands
*/
class ComposerCommand extends Command
{
protected $signature = 'phpvms:composer {cmd}';
protected $description = 'Composer related tasks';
/**
* Run composer update related commands
*/
public function handle()
{
switch(trim($this->argument('cmd')))
{
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') {
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
Artisan::call('ide-helper:generate');
Artisan::call('ide-helper:meta');
}
}
}
}