lasthourcloud/app/Models/Server.php

40 lines
809 B
PHP
Raw Normal View History

<?php
namespace App\Models;
class Server extends BaseModel
{
2023-03-30 15:52:19 +02:00
protected static function booted()
{
static::created(function ($server) {
ServerSetting::create([
'server_id' => $server->id,
]);
});
}
protected $fillable = [
'name',
'ip',
'user',
'port',
'team_id',
'private_key_id',
];
2023-05-02 12:47:52 +02:00
public function standaloneDockers()
2023-04-25 14:43:35 +02:00
{
2023-05-02 12:47:52 +02:00
return $this->hasMany(StandaloneDocker::class);
}
public function swarmDockers()
{
return $this->hasMany(SwarmDocker::class);
2023-04-25 14:43:35 +02:00
}
2023-03-27 14:31:42 +02:00
public function privateKey()
{
2023-03-27 14:31:42 +02:00
return $this->belongsTo(PrivateKey::class);
}
2023-03-30 15:52:19 +02:00
public function settings()
{
return $this->hasOne(ServerSetting::class);
}
}