29 lines
559 B
PHP
29 lines
559 B
PHP
<?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
|
|
{
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'started_at' => 'datetime',
|
|
'finished_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function steps(): HasMany
|
|
{
|
|
return $this->hasMany(Step::class);
|
|
}
|
|
|
|
public function deployable(): MorphTo
|
|
{
|
|
return $this->morphTo('target');
|
|
}
|
|
}
|