Answer the question
In order to leave comments, you need to log in
How to remove fields from Laravel Resource related relationships?
While I understand what server rendering is, I wanted to know - how can I hide fields from models in relations if I use json from Laravel? Those. I form json through Laravel Resource and there you can specify all the fields of the table. But if I need to get data from related type models in Vue, {{user.group.category.name}}
then in the Laravel controller I need to make a type request, $users->with('group.category');(
and if for $user in the UserResource file I can specify only the fields I need like user.name or user.lastname (and all the rest will be frame) then for the associated models, laravel generates json with all fields. Is it possible to also set only the required fields for such relationships?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question