Skip to content

Commit c733bde

Browse files
wimskilaravel-ide-helper
and
laravel-ide-helper
authored
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 <laravel-ide-helper@users.noreply.github.com>
1 parent 52a4b64 commit c733bde

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ All notable changes to this project will be documented in this file.
1313
### Added
1414
- Add support of variadic parameters in `ide-helper:models` [\#1234 / shaffe-fr](https://github.com/barryvdh/laravel-ide-helper/pull/1234)
1515

16+
### Changed
17+
- Move default models helper filename to config [\#1241 / wimski](https://github.com/barryvdh/laravel-ide-helper/pull/1241)
18+
1619
2021-06-18, 2.10.1
1720
------------------
1821
### Added

config/ide-helper.php

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
1313

1414
'filename' => '_ide_helper.php',
1515

16+
/*
17+
|--------------------------------------------------------------------------
18+
| Models filename
19+
|--------------------------------------------------------------------------
20+
|
21+
| The default filename for the models helper file
22+
|
23+
*/
24+
25+
'models_filename' => '_ide_helper_models.php',
26+
1627
/*
1728
|--------------------------------------------------------------------------
1829
| Where to write the PhpStorm specific meta file

src/Console/ModelsCommand.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ class ModelsCommand extends Command
7878
* @var string
7979
*/
8080
protected $name = 'ide-helper:models';
81-
protected $filename = '_ide_helper_models.php';
81+
82+
/**
83+
* @var string
84+
*/
85+
protected $filename;
8286

8387
/**
8488
* The console command description.
@@ -131,7 +135,8 @@ public function __construct(Filesystem $files)
131135
*/
132136
public function handle()
133137
{
134-
$filename = $this->option('filename');
138+
$this->filename = $this->laravel['config']->get('ide-helper.models_filename', '_ide_helper_models.php');
139+
$filename = $this->option('filename') ?? $this->filename;
135140
$this->write = $this->option('write');
136141
$this->write_mixin = $this->option('write-mixin');
137142
$this->dirs = array_merge(
@@ -199,7 +204,7 @@ protected function getArguments()
199204
protected function getOptions()
200205
{
201206
return [
202-
['filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file', $this->filename],
207+
['filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file'],
203208
['dir', 'D', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
204209
'The model dir, supports glob patterns', [], ],
205210
['write', 'W', InputOption::VALUE_NONE, 'Write to Model file'],

0 commit comments

Comments
 (0)