Begin adding schedule processing jobs.
This commit is contained in:
parent
c0d7e02481
commit
c5f2dfd6f6
16 changed files with 626 additions and 49 deletions
|
@ -117,8 +117,8 @@ class Schedule extends Model implements CleansAttributes, ValidableContract
|
|||
'cron_minute' => 'string',
|
||||
'is_active' => 'boolean',
|
||||
'is_processing' => 'boolean',
|
||||
'last_run_at' => 'nullable|timestamp',
|
||||
'next_run_at' => 'nullable|timestamp',
|
||||
'last_run_at' => 'nullable|date',
|
||||
'next_run_at' => 'nullable|date',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,12 +27,13 @@ namespace Pterodactyl\Models;
|
|||
use Sofa\Eloquence\Eloquence;
|
||||
use Sofa\Eloquence\Validable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
use Sofa\Eloquence\Contracts\CleansAttributes;
|
||||
use Sofa\Eloquence\Contracts\Validable as ValidableContract;
|
||||
|
||||
class Task extends Model implements CleansAttributes, ValidableContract
|
||||
{
|
||||
use Eloquence, Validable;
|
||||
use BelongsToThrough, Eloquence, Validable;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
@ -130,14 +131,11 @@ class Task extends Model implements CleansAttributes, ValidableContract
|
|||
/**
|
||||
* Return the server a task is assigned to, acts as a belongsToThrough.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return \Znck\Eloquent\Relations\BelongsToThrough
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function server()
|
||||
{
|
||||
if ($schedule = $this->schedule) {
|
||||
return $schedule->server();
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Instance of Task must have an associated Schedule in the database.');
|
||||
}
|
||||
return $this->belongsToThrough(Server::class, Schedule::class);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue