Jan 21, 2025
0
Level 1
Laravel Nova duplicated relationship query
I'm making Laravel App using Laravel Nova 5.
There are the following models and relationships:
- Articles belongs to Category
- Categories belongs to Parent Category
The relationships in the models are defined as required on both sides, also as relationship fields in the Nova resources.
When debugging with DebugBar I found that when updating models belonging to Category (no matter Article or Child Category) the Nova's PUT request for updating is making multiple lookups for the parent category:
- ''select * from
blog_categorieswhereblog_categories.id= 8 limit 1" - "select * from
blog_categorieswhereblog_categories.id= '8' limit 1" - "select * from
blog_categorieswhereblog_categories.id= 8 limit 1" - "select * from
blog_categorieswhereblog_categories.id= '8' limit 1"
The behavior is not caused because of the tree functionality.
Is there any logic for that?
Please or to participate in this conversation.