I was wondering if it is possible to define different data for item resource and collection resource.
For collection I only want to send [\'id\', \'title\', \
If you want the response fields to have the same value in the Resource and Collection, you can reuse the Resource inside the Collection
PersonResource.php
$this->id,
'person_type' => $this->person_type,
'first_name' => $this->first_name,
'last_name' => $this->last_name,
'created_at' => (string) $this->created_at,
'updated_at' => (string) $this->updated_at,
];
}
}
PersonCollection.php
collection);
}
}