В методе сбора я могу переименовать весь результат следующим образом:
<?php
namespace App\Http\Resources\v1;
use Illuminate\Http\Resources\Json\Resource;
class Property extends Resource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->SOMEFIELD,
'featured' => $this->SOMEFIELD,
'superFeatured' => $this->SOMEFIELD,
//THIS ONE COMES FROM A RELATIONSHIP
'description' => $this->propertyAdvertisement->SOMEFIELD,
'saleValue' => $this->SOMEFIELD,
'saleFormOfPayment' => $this->SOMEFIELD,
'vacationRentValue' => $this->SOMEFIELD,
'annualRentValue' => $this->SOMEFIELD,
'dormitories' => $this->SOMEFIELD,
'suites' => $this->SOMEFIELD,
'wc' => $this->SOMEFIELD,
'parkingSpaces' => $this->SOMEFIELD,
'coverImage' => $this->SOMEFIELD,
'coverDescription' => $this->SOMEFIELD,
'coverOrder' => $this->SOMEFIELD,
'features' => $this->SOMEFIELD,
'category' => $this->SOMEFIELD,
'subcategory' => $this->SOMEFIELD,
'city' => $this->SOMEFIELD,
'condominium' => $this->SOMEFIELD,
'neighborhood' => $this->SOMEFIELD,
'ref' => $this->SOMEFIELD,
'privateArea' => $this->SOMEFIELD,
'totalArea' => $this->SOMEFIELD,
'terrainSize' => $this->SOMEFIELD,
'finances' => $this->SOMEFIELD,
'ownerParcels' => $this->SOMEFIELD
];
}
}
Таким образом, только одна коллекция может переименовать весь результат.