-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Hi,
I have "virtual" relationship declared as:
public function relationships($request): iterable
{
return [
...iterator_to_array(parent::relationships($request)),
$this->relation('currentCouple')->withData(fn (Patient $patient) => $patient->getCurrentCouple()),
];
}
in my resource class. It's works fine when i invoke alwaysShowData()
, but, when i want to include this relation via include query param i get:
Relationship currentCouple does not exist on resource schema patients.
why jsonapi trying to get data from model when i declared withData()? How to make it works without alwaysShowData()
?
According to https://laraveljsonapi.io/docs/2.0/resources/relationships.html#specifying-data it should works as i expected ;)
Metadata
Metadata
Assignees
Labels
No labels