Move default models filename to config (#1241)

* Move default models filename to config

* Add default value when getting models helper filename from config

* composer fix-style

Co-authored-by: laravel-ide-helper <[email protected]>
This commit is contained in:
Wim Reckman
2021-08-10 07:12:56 +02:00
committed by GitHub
co-authored by laravel-ide-helper
parent 52a4b64656
commit c733bde1ea
3 changed files with 22 additions and 3 deletions
+3
View File
@@ -13,6 +13,9 @@ All notable changes to this project will be documented in this file.
### Added
- Add support of variadic parameters in `ide-helper:models` [\#1234 / shaffe-fr](https://github.com/barryvdh/laravel-ide-helper/pull/1234)
### Changed
- Move default models helper filename to config [\#1241 / wimski](https://github.com/barryvdh/laravel-ide-helper/pull/1241)
2021-06-18, 2.10.1
------------------
### Added
+11
View File
@@ -13,6 +13,17 @@ return [
'filename' => '_ide_helper.php',
/*
|--------------------------------------------------------------------------
| Models filename
|--------------------------------------------------------------------------
|
| The default filename for the models helper file
|
*/
'models_filename' => '_ide_helper_models.php',
/*
|--------------------------------------------------------------------------
| Where to write the PhpStorm specific meta file
+8 -3
View File
@@ -78,7 +78,11 @@ class ModelsCommand extends Command
* @var string
*/
protected $name = 'ide-helper:models';
protected $filename = '_ide_helper_models.php';
/**
* @var string
*/
protected $filename;
/**
* The console command description.
@@ -131,7 +135,8 @@ class ModelsCommand extends Command
*/
public function handle()
{
$filename = $this->option('filename');
$this->filename = $this->laravel['config']->get('ide-helper.models_filename', '_ide_helper_models.php');
$filename = $this->option('filename') ?? $this->filename;
$this->write = $this->option('write');
$this->write_mixin = $this->option('write-mixin');
$this->dirs = array_merge(
@@ -199,7 +204,7 @@ class ModelsCommand extends Command
protected function getOptions()
{
return [
['filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file', $this->filename],
['filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file'],
['dir', 'D', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
'The model dir, supports glob patterns', [], ],
['write', 'W', InputOption::VALUE_NONE, 'Write to Model file'],