42 lines
970 B
PHP
42 lines
970 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class RestoreRun extends Model
|
|
{
|
|
use HasFactory;
|
|
use SoftDeletes;
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $casts = [
|
|
'is_dry_run' => 'boolean',
|
|
'requested_items' => 'array',
|
|
'preview' => 'array',
|
|
'results' => 'array',
|
|
'metadata' => 'array',
|
|
'started_at' => 'datetime',
|
|
'completed_at' => 'datetime',
|
|
];
|
|
|
|
public function tenant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Tenant::class);
|
|
}
|
|
|
|
public function backupSet(): BelongsTo
|
|
{
|
|
return $this->belongsTo(BackupSet::class);
|
|
}
|
|
|
|
public function scopeDeletable($query)
|
|
{
|
|
return $query->whereIn('status', ['completed', 'failed', 'aborted', 'completed_with_errors']);
|
|
}
|
|
}
|