This commit is contained in:
Saeed Vaziry
2025-06-04 08:08:20 +02:00
parent efacadba10
commit c3f69f3247
114 changed files with 4032 additions and 765 deletions

View File

@ -0,0 +1,31 @@
<?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,
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Resources;
use App\Models\Command;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/** @mixin Command */
class CommandResource extends JsonResource
{
/**
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'server_id' => $this->site->server_id,
'site_id' => $this->site_id,
'name' => $this->name,
'command' => $this->command,
'variables' => $this->getVariables(),
'updated_at' => $this->updated_at,
'created_at' => $this->created_at,
];
}
}

View 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,
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Resources;
use App\Models\LoadBalancerServer;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/** @mixin LoadBalancerServer */
class LoadBalancerServerResource extends JsonResource
{
/**
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'load_balancer_id' => $this->load_balancer_id,
'ip' => $this->ip,
'port' => $this->port,
'weight' => $this->weight,
'backup' => $this->backup,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}

View File

@ -16,11 +16,13 @@ public function toArray(Request $request): array
{
return [
'id' => $this->id,
'server_id' => $this->site->server_id,
'site_id' => $this->site_id,
'mode' => $this->mode,
'from' => $this->from,
'to' => $this->to,
'mode' => $this->mode,
'status' => $this->status,
'status_color' => Redirect::$statusColors[$this->status] ?? 'gray',
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];

View File

@ -17,6 +17,7 @@ public function toArray(Request $request): array
return [
'id' => $this->id,
'project_id' => $this->project_id,
'services' => $this->services()->pluck('name', 'type'),
'user_id' => $this->user_id,
'provider_id' => $this->provider_id,
'name' => $this->name,

View File

@ -21,18 +21,22 @@ public function toArray(Request $request): array
'source_control_id' => $this->source_control_id,
'type' => $this->type,
'type_data' => $this->type_data,
'features' => $this->type()->supportedFeatures(),
'domain' => $this->domain,
'aliases' => $this->aliases,
'web_directory' => $this->web_directory,
'webserver' => $this->webserver()->name(),
'path' => $this->path,
'php_version' => $this->php_version,
'repository' => $this->repository,
'branch' => $this->branch,
'status' => $this->status,
'status_color' => Site::$statusColors[$this->status] ?? 'default',
'auto_deploy' => $this->isAutoDeployment(),
'port' => $this->port,
'user' => $this->user,
'url' => $this->getUrl(),
'force_ssl' => $this->force_ssl,
'progress' => $this->progress,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Resources;
use App\Models\Ssl;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/** @mixin Ssl */
class SslResource extends JsonResource
{
/**
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'server_id' => $this->site->server_id,
'site_id' => $this->site_id,
'is_active' => $this->is_active,
'type' => $this->type,
'status' => $this->status,
'log' => $this->log_id ? ServerLogResource::make($this->log) : null,
'status_color' => Ssl::$statusColors[$this->status] ?? 'secondary',
'expires_at' => $this->expires_at,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}