🔥 Laravel Tip: get one column of one record in a one-to-many relationship
Mar 24, 2022
If you're only using one record from your one-to-many relationships, you can use subqueries instead of loading all the records.
For example, if I only need to know the title of the most viewed post from a user.
This can reduce your memory usage significantly.
For example, if I only need to know the title of the most viewed post from a user.
This can reduce your memory usage significantly.
Other tips:
🔥 Laravel Tip: make method constructor parameters
Apr 16, 2022
🔥 Laravel Tip: the discardChanges method.
Nov 29, 2022
🔥 Laravel tip: The `whereRelation` method
Oct 18, 2022