Closed lironesamoun closed 3 years ago
The answer is this line is incorrect:
return "$asset->name";
You're returning a string, which is not a valid value for relationship data.
Should be:
return $asset->histories
assuming the relationship is called histories
on your Asset
model class.
hi,
I try to do the following:
http://127.0.0.1:8000/api/v1/assets/27?include=histories
The relationship is defined between an asset and a history. An asset has multiple histories and one history belong to an asset.
I have this error:
On my Schema.php
On the validator, the "histories" is included to the array.
Could you please help on that ? Thank