mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
33 lines
964 B
PHP
33 lines
964 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\Deployment;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/** @mixin Deployment */
|
|
class DeploymentResource extends JsonResource
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'site_id' => $this->site_id,
|
|
'deployment_script_id' => $this->deployment_script_id,
|
|
'log_id' => $this->log_id,
|
|
'log' => new ServerLogResource($this->log),
|
|
'commit_id' => $this->commit_id,
|
|
'commit_id_short' => $this->commit_id_short,
|
|
'commit_data' => $this->commit_data,
|
|
'status' => $this->status,
|
|
'status_color' => Deployment::$statusColors[$this->status] ?? 'gray',
|
|
'updated_at' => $this->updated_at,
|
|
'created_at' => $this->created_at,
|
|
];
|
|
}
|
|
}
|