Begin adding schedule processing jobs.

This commit is contained in:
Dane Everitt 2017-09-16 23:10:00 -05:00
parent c0d7e02481
commit c5f2dfd6f6
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
16 changed files with 626 additions and 49 deletions

View file

@ -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',
];
/**

View file

@ -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);
}
}