Files
vito/app/Http/Resources/CommandExecutionResource.php
Saeed Vaziry c3f69f3247 #591 - sites
2025-06-04 08:08:20 +02:00

32 lines
929 B
PHP

<?php
namespace App\Http\Resources;
use App\Models\CommandExecution;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/** @mixin CommandExecution */
class CommandExecutionResource extends JsonResource
{
/**
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'command_id' => $this->command_id,
'server_id' => $this->server_id,
'user_id' => $this->user_id,
'server_log_id' => $this->server_log_id,
'log' => ServerLogResource::make($this->serverLog),
'variables' => $this->variables,
'status' => $this->status,
'status_color' => CommandExecution::$statusColors[$this->status] ?? 'gray',
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}