This commit is contained in:
Joao Patricio
2023-05-03 06:23:45 +01:00
parent e7763f3b73
commit 00a8c847e9
17 changed files with 621 additions and 2 deletions

View File

@@ -2,6 +2,9 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Spatie\SchemalessAttributes\Casts\SchemalessAttributes;
class Server extends BaseModel
{
protected static function booted()
@@ -12,10 +15,21 @@ class Server extends BaseModel
]);
});
}
public $casts = [
'extra_attributes' => SchemalessAttributes::class,
];
public function scopeWithExtraAttributes(): Builder
{
return $this->extra_attributes->modelScope();
}
public function privateKey()
{
return $this->belongsTo(PrivateKey::class);
}
public function settings()
{
return $this->hasOne(ServerSetting::class);