Add basic listing of server schedules

This commit is contained in:
Dane Everitt 2020-02-08 15:23:08 -08:00
parent f9ec96c70a
commit 32e9fb0346
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
21 changed files with 508 additions and 79 deletions

View file

@ -2,6 +2,29 @@
namespace Pterodactyl\Models;
use Illuminate\Container\Container;
use Pterodactyl\Contracts\Extensions\HashidsInterface;
/**
* @property int $id
* @property int $server_id
* @property string $name
* @property string $cron_day_of_week
* @property string $cron_day_of_month
* @property string $cron_hour
* @property string $cron_minute
* @property bool $is_active
* @property bool $is_processing
* @property \Carbon\Carbon|null $last_run_at
* @property \Carbon\Carbon|null $next_run_at
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
*
* @property string $hashid
*
* @property \Pterodactyl\Models\Server $server
* @property \Pterodactyl\Models\Task[]|\Illuminate\Support\Collection $tasks
*/
class Schedule extends Validable
{
/**
@ -51,8 +74,6 @@ class Schedule extends Validable
* @var array
*/
protected $dates = [
self::CREATED_AT,
self::UPDATED_AT,
'last_run_at',
'next_run_at',
];
@ -93,7 +114,7 @@ class Schedule extends Validable
*/
public function getHashidAttribute()
{
return app()->make('hashids')->encode($this->id);
return Container::getInstance()->make(HashidsInterface::class)->encode($this->id);
}
/**

View file

@ -2,8 +2,26 @@
namespace Pterodactyl\Models;
use Illuminate\Container\Container;
use Znck\Eloquent\Traits\BelongsToThrough;
use Pterodactyl\Contracts\Extensions\HashidsInterface;
/**
* @property int $id
* @property int $schedule_id
* @property int $sequence_id
* @property string $action
* @property string $payload
* @property int $time_offset
* @property bool $is_queued
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
*
* @property string $hashid
*
* @property \Pterodactyl\Models\Schedule $schedule
* @property \Pterodactyl\Models\Server $server
*/
class Task extends Validable
{
use BelongsToThrough;
@ -83,7 +101,7 @@ class Task extends Validable
*/
public function getHashidAttribute()
{
return app()->make('hashids')->encode($this->id);
return Container::getInstance()->make(HashidsInterface::class)->encode($this->id);
}
/**