Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

chore: Refactor instanceSettings() function to improve code readability

Andras Bacsai4db50bd0251b
diff --git a/app/Livewire/Settings/Index.php b/app/Livewire/Settings/Index.php
index c529702589..4eab505e9e 100644
--- a/app/Livewire/Settings/Index.php
+++ b/app/Livewire/Settings/Index.php
@@ -60,7 +60,7 @@ class Index extends Component
public function mount()
{
if (isInstanceAdmin()) {
- $this->settings = InstanceSettings::get();
+ $this->settings = instanceSettings();
$this->do_not_track = $this->settings->do_not_track;
$this->is_auto_update_enabled = $this->settings->is_auto_update_enabled;
$this->is_registration_enabled = $this->settings->is_registration_enabled;
diff --git a/app/Models/InstanceSettings.php b/app/Models/InstanceSettings.php
index 6a9876c9bd..bb3d1478b6 100644
--- a/app/Models/InstanceSettings.php
+++ b/app/Models/InstanceSettings.php
@@ -89,12 +89,12 @@ class InstanceSettings extends Model implements SendsEmail
public function helperVersion(): Attribute
{
return Attribute::make(
- get: function () {
+ get: function ($value) {
if (isDev()) {
return 'latest';
}
- return $this->helper_version;
+ return $value;
}
);
}
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index 080d0d0167..3ed2c2d13a 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -3893,3 +3893,7 @@ function convertComposeEnvironmentToArray($environment)
return $convertedServiceVariables;
}
+function instanceSettings()
+{
+ return InstanceSettings::get();
+}