- Implemented DomainCollection, DomainDetailResource, DomainNSCollection, DomainNSResource, and DomainResource for handling DNS domain and record data. - Created VpsServiceCollection and VpsServiceResource for VPS service management. - Added DnsManagerNS and DnsManagerUser models to represent DNS records and user associations. - Developed AdminZoneDnsSqlImporter for importing DNS data from SQL dumps, including customer and DNS domain records. - Added migration scripts to update the customers table with new fields and sync foreign key references for DNS tables. - Created a migration preview document outlining the mapping and schema changes for the admin zone DNS import.
35 lines
864 B
PHP
35 lines
864 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Api\Service;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\ResourceCollection;
|
|
|
|
class DomainCollection extends ResourceCollection
|
|
{
|
|
public $collects = DomainResource::class;
|
|
|
|
/**
|
|
* Transform the resource collection into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
$data = [
|
|
'items' => $this->collection,
|
|
];
|
|
|
|
if (method_exists($this->resource, 'total')) {
|
|
$data['pagination'] = [
|
|
'total' => $this->resource->total(),
|
|
'per_page' => $this->resource->perPage(),
|
|
'current_page' => $this->resource->currentPage(),
|
|
'last_page' => $this->resource->lastPage(),
|
|
];
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
}
|