zheliazkov's avatar

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:

  1. ''select * from blog_categories where blog_categories.id = 8 limit 1"
  2. "select * from blog_categories where blog_categories.id = '8' limit 1"
  3. "select * from blog_categories where blog_categories.id = 8 limit 1"
  4. "select * from blog_categories where blog_categories.id = '8' limit 1"

The behavior is not caused because of the tree functionality.

Is there any logic for that?

0 likes
0 replies

Please or to participate in this conversation.