Feb 25, 2021
0
Level 2
laravel api Resource extra query
i have table category and table category_info which has translation of category.
and in category model i have a relation :
translation_category_info which get the translation with current locale .
i loaded the relationship category.translation_category_info .
in api resource i want to display the title of translation_category_info like this :
'title' => $this->translation_category_info->isNotEmpty() ? $this->translation_category_info->first()->title : '',
is this line will make another query to get the title or get the title from the data already loaded Thanks
Please or to participate in this conversation.