mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 06:43:45 +02:00
Add basic listing of server schedules
This commit is contained in:
36
app/Transformers/Api/Client/TaskTransformer.php
Normal file
36
app/Transformers/Api/Client/TaskTransformer.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Pterodactyl\Transformers\Api\Client;
|
||||
|
||||
use Pterodactyl\Models\Task;
|
||||
|
||||
class TaskTransformer extends BaseClientTransformer
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
return Task::RESOURCE_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a schedule's task into a client viewable format.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Task $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Task $model)
|
||||
{
|
||||
return [
|
||||
'id' => $model->id,
|
||||
'sequence_id' => $model->sequence_id,
|
||||
'action' => $model->action,
|
||||
'payload' => $model->payload,
|
||||
'time_offset' => $model->time_offset,
|
||||
'is_queued' => $model->is_queued,
|
||||
'created_at' => $model->created_at->toIso8601String(),
|
||||
'updated_at' => $model->updated_at->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user