Welcome Guest, Not a member yet? Register   Sign In
What is the best practice for querying a DB with 2 or 3 tables
#4

A large join query retrieves all data at once but may produce a lot of results, and can be handled in the BlogModel. Alternatively, you can first fetch blog posts and then query tags separately, splitting the logic between BlogModel and TagModel. Method chaining, like getBlog()->withTags()->paginate(), offers a clean approach by keeping related logic organized and accessible within the BlogModel, making it a flexible and efficient choice.
Reply


Messages In This Thread
RE: What is the best practice for querying a DB with 2 or 3 tables - by Rizzk - 07-31-2024, 02:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB