Merge remote-tracking branch 'origin/v4' into ijpatricio-wip-4
# Conflicts: # bootstrap/helpers.php # docker/dev/supervisord.conf
This commit is contained in:
@@ -18,4 +18,7 @@ class Project extends BaseModel
|
||||
public function settings() {
|
||||
return $this->hasOne(ProjectSetting::class);
|
||||
}
|
||||
public function applications() {
|
||||
return $this->hasManyThrough(Application::class, Environment::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,20 @@ namespace App\Models;
|
||||
|
||||
class Server extends BaseModel
|
||||
{
|
||||
protected static function booted()
|
||||
{
|
||||
static::created(function ($server) {
|
||||
ServerSetting::create([
|
||||
'server_id' => $server->id,
|
||||
]);
|
||||
});
|
||||
}
|
||||
public function privateKey()
|
||||
{
|
||||
return $this->belongsTo(PrivateKey::class);
|
||||
}
|
||||
public function settings()
|
||||
{
|
||||
return $this->hasOne(ServerSetting::class);
|
||||
}
|
||||
}
|
||||
|
||||
11
app/Models/ServerSetting.php
Normal file
11
app/Models/ServerSetting.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class ServerSetting extends BaseModel
|
||||
{
|
||||
public function server()
|
||||
{
|
||||
return $this->belongsTo(Server::class);
|
||||
}
|
||||
}
|
||||
@@ -16,4 +16,7 @@ class Team extends BaseModel
|
||||
public function servers() {
|
||||
return $this->hasMany(Server::class);
|
||||
}
|
||||
public function applications() {
|
||||
return $this->hasManyThrough(Application::class, Project::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user