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.

Add fqdn attribute to InstanceSettings model

Andras Bacsaid058e0421396
diff --git a/app/Models/InstanceSettings.php b/app/Models/InstanceSettings.php
index 0575953514..8461481599 100644
--- a/app/Models/InstanceSettings.php
+++ b/app/Models/InstanceSettings.php
@@ -3,8 +3,10 @@
namespace App\Models;
use App\Notifications\Channels\SendsEmail;
+use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
+use Spatie\Url\Url;
class InstanceSettings extends Model implements SendsEmail
{
@@ -16,6 +18,18 @@ class InstanceSettings extends Model implements SendsEmail
'smtp_password' => 'encrypted',
];
+ public function fqdn(): Attribute
+ {
+ return Attribute::make(
+ set: function ($value) {
+ if ($value) {
+ $url = Url::fromString($value);
+ $host = $url->getHost();
+ return $url->getScheme() . '://' . $host;
+ }
+ }
+ );
+ }
public static function get()
{
return InstanceSettings::findOrFail(0);