2024-01-01 18:33:16 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2024-01-02 02:23:29 +00:00
|
|
|
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);
|
|
|
|
}
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2024-01-02 02:23:29 +00:00
|
|
|
public function application()
|
2024-01-01 18:33:16 +00:00
|
|
|
{
|
2024-01-02 02:23:29 +00:00
|
|
|
return $this->belongsTo(Application::class);
|
2024-01-01 18:33:16 +00:00
|
|
|
}
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2024-01-02 02:23:29 +00:00
|
|
|
public function latest_log(): HasOne
|
2024-01-01 18:33:16 +00:00
|
|
|
{
|
2024-01-02 02:23:29 +00:00
|
|
|
return $this->hasOne(ScheduledTaskExecution::class)->latest();
|
|
|
|
}
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2024-01-02 02:23:29 +00:00
|
|
|
public function executions(): HasMany
|
|
|
|
{
|
|
|
|
return $this->hasMany(ScheduledTaskExecution::class);
|
2024-01-01 18:33:16 +00:00
|
|
|
}
|
|
|
|
}
|