deployments wip
This commit is contained in:
20
app/Models/Deployment.php
Normal file
20
app/Models/Deployment.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
class Deployment extends Model
|
||||
{
|
||||
public function steps(): HasMany
|
||||
{
|
||||
return $this->hasMany(Step::class);
|
||||
}
|
||||
|
||||
public function deployable(): MorphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use App\Enums\ServiceType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
|
||||
class Service extends Model
|
||||
{
|
||||
@@ -33,6 +34,11 @@ class Service extends Model
|
||||
return $this->hasMany(Slice::class);
|
||||
}
|
||||
|
||||
public function deployments(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Deployment::class, 'deployable');
|
||||
}
|
||||
|
||||
public function driver()//: Driver
|
||||
{
|
||||
// @todo. This is the class that controls the service
|
||||
|
||||
14
app/Models/Step.php
Normal file
14
app/Models/Step.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Step extends Model
|
||||
{
|
||||
public function deployment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Deployment::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user