Skip to content

Commit b77764f

Browse files
telkinsglorand
authored andcommitted
Removed Model::getConnectionName() override and moved fallback to each call.
1 parent 599c711 commit b77764f

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/Managers/TableSettingsManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function apply(array $settings = []): SettingsManagerContract
3030
} else {
3131
if (!$modelSettings) {
3232
$modelSettings = new ModelSettings();
33-
$modelSettings->setConnection($this->model->getConnectionName());
33+
$modelSettings->setConnection($this->model->getConnectionName() ?? config('database.default'));
3434
$modelSettings->model()->associate($this->model);
3535
}
3636
$modelSettings->settings = $settings;

src/Traits/HasSettingsField.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,6 @@ public function getSettingsFieldName(): string
7575
return $this->settingsFieldName ?? config('model_settings.settings_field_name');
7676
}
7777

78-
/**
79-
* @return string
80-
*/
81-
public function getConnectionName(): string
82-
{
83-
return $this->connection ?? config('database.default');
84-
}
85-
8678
/**
8779
* @return bool
8880
*/
@@ -109,7 +101,7 @@ private function hasSettingsField()
109101
config('model_settings.settings_table_cache_prefix') . '::has_field',
110102
now()->addDays(1),
111103
function () {
112-
return Schema::connection($this->getConnectionName())
104+
return Schema::connection($this->getConnectionName() ?? config('database.default'))
113105
->hasColumn(
114106
$this->getTable(),
115107
$this->getSettingsFieldName()

0 commit comments

Comments
 (0)