Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions config/ide-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,26 @@

],

/*
|--------------------------------------------------------------------------
| Support for custom DB connection information
|--------------------------------------------------------------------------
|
| This setting allow you to override settings in your database config. This is useful for when models may
| connection to difference databases i.e., you have a multi-tenancy setup.
|
| Complete the overrider with the specific entries you wish to override and these will be applied to the
| config('database.connections') config array:
|
| "tenant" => array(
| "database" => "test_tenant_database",
| ),
|
*/
'db_connection_overrides' => [

],

/*
|--------------------------------------------------------------------------
| Support for camel cased models
Expand Down
9 changes: 7 additions & 2 deletions src/Console/ModelsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ public function handle()
{
$this->filename = $this->laravel['config']->get('ide-helper.models_filename', '_ide_helper_models.php');
$filename = $this->option('filename') ?? $this->filename;
$db_overrides = $this->laravel['config']->get('ide-helper.db_connection_overrides');
if (is_array($db_overrides)) {
$db_overrides = array_replace_recursive($this->laravel['config']->get('database.connections'), $db_overrides);
$this->laravel['config']->set('database.connections', $db_overrides);
}
$this->write = $this->option('write');
$this->write_mixin = $this->option('write-mixin');
$this->dirs = array_merge(
Expand Down Expand Up @@ -931,14 +936,14 @@ protected function createPhpDocs($class)

// remove the already existing tag to prevent duplicates
foreach ($phpdoc->getTagsByName('mixin') as $tag) {
if($tag->getContent() === $eloquentClassNameInModel) {
if ($tag->getContent() === $eloquentClassNameInModel) {
$phpdoc->deleteTag($tag);
}
}

$phpdoc->appendTag(Tag::createInstance('@mixin ' . $eloquentClassNameInModel, $phpdoc));
}

if ($this->phpstorm_noinspections) {
/**
* Facades, Eloquent API
Expand Down