Sort of working beta
This commit is contained in:
@ -4,9 +4,34 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class JobRun extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\JobRunFactory> */
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
"job_id",
|
||||
"success",
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
"success" => "boolean",
|
||||
];
|
||||
|
||||
protected $with = ['artifacts'];
|
||||
|
||||
public function job(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Job::class);
|
||||
}
|
||||
|
||||
public function artifacts(): HasMany
|
||||
{
|
||||
return $this->hasMany(JobArtifact::class);
|
||||
}
|
||||
|
||||
public function addArtifact(JobArtifact $artifact): void
|
||||
{
|
||||
$this->artifacts()->save($artifact);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user