You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This my code in controller.
Customer is an Eloquent model
$query = Customer::with('country');
customers = QueryBuilder::for($query)
->allowedFilters([AllowedFilter::exact('id'), AllowedFilter::exact('organization_id'), 'name'])
->allowedFields(['id', 'created_at', 'updated_at', 'organization_id', 'name', 'country.id', 'country.name'])
->allowedIncludes('country')
->defaultSort('id')
->allowedSorts('id', 'name')
->jsonPaginate();
I make a get request to
https://timci.lndo.site/api/customers?include=country&fields[customers]=id,name&fields[country]=id,name
It returns the customers data BUT it doesn't return fields id and name of countries.
Am I doing anything wrong?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions