lasthourcloud/app/Models/ScheduledTask.php

29 lines
636 B
PHP
Raw Normal View History

2024-01-01 18:33:16 +00:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
2024-01-01 18:33:16 +00:00
class ScheduledTask extends BaseModel
{
protected $guarded = [];
public function service()
{
return $this->belongsTo(Service::class);
}
public function application()
2024-01-01 18:33:16 +00:00
{
return $this->belongsTo(Application::class);
2024-01-01 18:33:16 +00:00
}
public function latest_log(): HasOne
2024-01-01 18:33:16 +00:00
{
return $this->hasOne(ScheduledTaskExecution::class)->latest();
}
public function executions(): HasMany
{
return $this->hasMany(ScheduledTaskExecution::class);
2024-01-01 18:33:16 +00:00
}
}