-
-
Save owenvoke/8cfa9c42bca91f40592d1641163e31e3 to your computer and use it in GitHub Desktop.
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 | |
namespace App\Console\Commands; | |
use Illuminate\Console\Command; | |
/** | |
* A command that handles IDE helper generation of helper file and PHPStorm metadata against platform environment. | |
* This command performs these actions in development environment, else it does nothing, but does not crash the project. | |
* | |
* @author Lyubomir Gardev (@Rolice) | |
* @author Owen Voke (@pxgamer) | |
*/ | |
class IdeHelperHandlerCommand extends Command | |
{ | |
/** {@inheritdoc} */ | |
protected $signature = 'ide-helper:handle | |
{--with-facades : Generate the `_ide_helper.php` file} | |
{--with-models : Generate the `_ide_helper_models.php` file} | |
{--with-meta : Generate the `.phpstorm.meta.php` file}'; | |
/** {@inheritdoc} */ | |
protected $description = 'Handles ide-helper generation through composer'; | |
/** {@inheritdoc} */ | |
public function handle(): void | |
{ | |
$ideHelperProvider = '\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider'; | |
if (! in_array(app()->environment(), ['local', 'development']) || ! class_exists($ideHelperProvider)) { | |
return; | |
} | |
if ($this->option('with-facades')) { | |
$this->call('ide-helper:generate'); | |
} | |
if ($this->option('with-models')) { | |
$this->call('ide-helper:models'); | |
} | |
if ($this->option('with-meta')) { | |
$this->call('ide-helper:meta'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment