My dear, I found this wonderful source https://www.youtube.com/watch?v=ijt10uTM8LY that shows us 5 Laravel Relationship Tips that are useful to us. They will make us happy in our projects and write our code. I will touch quickly on them, but visit the source and deepen it a lot
- withDefault()
We have in the database some Category that do not have a parent, and we do not want to show the empty value. Here comes the withDefault()
- Eager and Lazy Loading With Constraint
- Querying Relationship Existence With Constraint
Let's single out some limitations on finding results using whereHas
- Shorter Syntax to Query Relationship Existence
- Eager Loading and Query Relationship Existence Combo
I hope you enjoyed the code and I wish you always a happy code .
Top comments (0)