2023-08-08 15:28:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
2023-08-10 13:52:54 +00:00
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
|
|
|
2023-08-09 14:47:24 +00:00
|
|
|
class ScheduledDatabaseBackup extends BaseModel
|
2023-08-08 15:28:36 +00:00
|
|
|
{
|
|
|
|
protected $guarded = [];
|
|
|
|
|
2023-08-10 13:52:54 +00:00
|
|
|
public function database(): MorphTo
|
2023-08-08 15:28:36 +00:00
|
|
|
{
|
|
|
|
return $this->morphTo();
|
|
|
|
}
|
2023-08-10 13:52:54 +00:00
|
|
|
|
|
|
|
public function latest_log(): HasOne
|
|
|
|
{
|
|
|
|
return $this->hasOne(ScheduledDatabaseBackupExecution::class)->latest();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function executions(): HasMany
|
|
|
|
{
|
|
|
|
return $this->hasMany(ScheduledDatabaseBackupExecution::class);
|
|
|
|
}
|
2023-08-11 14:13:53 +00:00
|
|
|
|
|
|
|
public function s3()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(S3Storage::class, 's3_storage_id');
|
|
|
|
}
|
2023-08-08 15:28:36 +00:00
|
|
|
}
|