lasthourcloud/app/Models/Server.php
Andras Bacsai 2487dde69e add new server
add new private key
check server connection
2023-04-26 15:38:50 +02:00

36 lines
700 B
PHP

<?php
namespace App\Models;
class Server extends BaseModel
{
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',
];
public function destinations()
{
return $this->hasMany(PrivateKey::class);
}
public function privateKey()
{
return $this->belongsTo(PrivateKey::class);
}
public function settings()
{
return $this->hasOne(ServerSetting::class);
}
}