mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
INA-5 | Add service | append linked job
This commit is contained in:
parent
5a6f4801ce
commit
89373701c9
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Services\TaskScheduler\TaskSchedulerService;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
@ -32,12 +33,27 @@ class Scheduler extends Model
|
|||||||
'repeat_every',
|
'repeat_every',
|
||||||
'scheduled_run',
|
'scheduled_run',
|
||||||
];
|
];
|
||||||
|
protected $appends = ['linked_job'];
|
||||||
|
|
||||||
const DAILY = 'DAY';
|
const DAILY = 'DAY';
|
||||||
const WEEKLY = 'WEEK';
|
const WEEKLY = 'WEEK';
|
||||||
const MONTHLY = 'MONTH';
|
const MONTHLY = 'MONTH';
|
||||||
const QUARTERLY = '3MONTHS';
|
const QUARTERLY = '3MONTHS';
|
||||||
const ANNUALLY = 'YEAR';
|
const ANNUALLY = 'YEAR';
|
||||||
|
|
||||||
|
public function getLinkedJobAttribute()
|
||||||
|
{
|
||||||
|
return $this->job ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service entry points.
|
||||||
|
*/
|
||||||
|
public function service(): TaskSchedulerService
|
||||||
|
{
|
||||||
|
return new TaskSchedulerService($this);
|
||||||
|
}
|
||||||
|
|
||||||
public function job(): \Illuminate\Database\Eloquent\Relations\HasOne
|
public function job(): \Illuminate\Database\Eloquent\Relations\HasOne
|
||||||
{
|
{
|
||||||
return $this->hasOne(ScheduledJob::class, 'scheduler_id', 'id');
|
return $this->hasOne(ScheduledJob::class, 'scheduler_id', 'id');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user