mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 06:56:15 +00:00
#591 - sites
This commit is contained in:
32
app/Http/Resources/DeploymentResource.php
Normal file
32
app/Http/Resources/DeploymentResource.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?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,
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user