misc_pterodactyl-panel/app/Http/Controllers/Api/Client/Servers/ScheduleController.php

29 lines
830 B
PHP
Raw Normal View History

2020-02-08 23:23:08 +00:00
<?php
namespace Pterodactyl\Http\Controllers\Api\Client\Servers;
use Illuminate\Http\Request;
use Pterodactyl\Models\Server;
use Pterodactyl\Transformers\Api\Client\ScheduleTransformer;
use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;
class ScheduleController extends ClientApiController
{
/**
* Returns all of the schedules belonging to a given server.
*
* @param \Illuminate\Http\Request $request
* @param \Pterodactyl\Models\Server $server
* @return array
*/
public function index(Request $request, Server $server)
{
$schedules = $server->schedule;
$schedules->loadMissing('tasks');
return $this->fractal->collection($schedules)
->transformWith($this->getTransformer(ScheduleTransformer::class))
->toArray();
}
}