chore: Refactor instanceSettings() function to improve code readability

This commit is contained in:
Andras Bacsai
2024-10-01 10:33:56 +02:00
parent 817bd9c35d
commit 4db50bd025
3 changed files with 7 additions and 3 deletions

View File

@@ -60,7 +60,7 @@ class Index extends Component
public function mount() public function mount()
{ {
if (isInstanceAdmin()) { if (isInstanceAdmin()) {
$this->settings = InstanceSettings::get(); $this->settings = instanceSettings();
$this->do_not_track = $this->settings->do_not_track; $this->do_not_track = $this->settings->do_not_track;
$this->is_auto_update_enabled = $this->settings->is_auto_update_enabled; $this->is_auto_update_enabled = $this->settings->is_auto_update_enabled;
$this->is_registration_enabled = $this->settings->is_registration_enabled; $this->is_registration_enabled = $this->settings->is_registration_enabled;

View File

@@ -89,12 +89,12 @@ class InstanceSettings extends Model implements SendsEmail
public function helperVersion(): Attribute public function helperVersion(): Attribute
{ {
return Attribute::make( return Attribute::make(
get: function () { get: function ($value) {
if (isDev()) { if (isDev()) {
return 'latest'; return 'latest';
} }
return $this->helper_version; return $value;
} }
); );
} }

View File

@@ -3893,3 +3893,7 @@ function convertComposeEnvironmentToArray($environment)
return $convertedServiceVariables; return $convertedServiceVariables;
} }
function instanceSettings()
{
return InstanceSettings::get();
}