1
0

big update all menus

This commit is contained in:
Wian Drs
2026-08-07 09:16:13 +07:00
parent 75342dc7b7
commit e7575ba1c0
101 changed files with 3451 additions and 89 deletions
+18
View File
@@ -10,6 +10,7 @@ class NasResource extends JsonResource
public function toArray(Request $request): array
{
$data = $this->resource->attributesToArray();
if ($this->resource instanceof \App\Models\NasMikrotik) $data['effective_backend_mode'] = $this->resource->effectiveBackendMode();
unset($data['api_password'], $data['radius_secret'], $data['community'], $data['auth_password'], $data['privacy_password'], $data['password']);
$data['tenant'] = $this->whenLoaded('tenant', fn () => [
@@ -17,6 +18,23 @@ class NasResource extends JsonResource
'tenant_code' => $this->tenant->tenant_code,
'tenant_name' => $this->tenant->tenant_name,
]);
$data['scripts'] = $this->whenLoaded('scripts', fn () => $this->scripts->map(fn ($policy) => [
'id' => $policy->id,
'code' => $policy->code,
'name' => $policy->name,
'service_type' => $policy->service_type,
'event' => $policy->event,
'current_version' => $policy->current_version,
'latest_version' => $policy->relationLoaded('latestVersion') && $policy->latestVersion ? [
'id' => $policy->latestVersion->id,
'version' => $policy->latestVersion->version,
] : null,
'pivot' => [
'event' => $policy->pivot->event,
'nas_script_policy_version_id' => $policy->pivot->nas_script_policy_version_id,
'enabled' => (bool) $policy->pivot->enabled,
],
]));
foreach ([
'api_password' => 'has_api_password',
@@ -23,9 +23,26 @@ class TicketResource extends JsonResource
'description' => $this->description,
'priority' => $this->priority,
'status' => $this->status,
'source' => $this->source,
'installation_step' => $this->installation_step,
'verified_by' => $this->verified_by,
'verified_at' => $this->verified_at,
'verification_notes' => $this->verification_notes,
'created_by' => $this->created_by,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'tenant_id' => $this->tenant_id,
'sla_minutes' => $this->sla_minutes,
'assigned_at' => $this->assigned_at,
'resolved_at' => $this->resolved_at,
'closed_at' => $this->closed_at,
'ticket_type' => $this->whenLoaded('ticketType'),
'tenant' => $this->whenLoaded('tenant'),
'customer' => $this->whenLoaded('customer'),
'creator' => $this->whenLoaded('creator'),
'assignments' => $this->whenLoaded('assignments'),
'materials' => $this->whenLoaded('materials'),
'attachments' => $this->whenLoaded('attachments'),
];
}
}