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