Articles

Laravel orWhere: how to use and group queries

1 month ago

In Laravel we can use the orWhere method to add an or SQL statement in our queries. The basic usage is pretty simple but it can get confusing when we...

Read more

Using pivot tables in Laravel: The complete guide to custom intermediary tables in many-to-many relationships

1 month ago

When working with many-to-many relationships the table structure is a little more complex than other relationships. When using many-to-many relationsh...

Read more

Which is faster: whereHas vs join

1 month ago

I have heard multiple times that whereHas queries are slower than join queries, so I decided to test it to figure out if I should stop writing whereHa...

Read more

Query a nested relationship with "where" clause using Eloquent

2 months ago

If you've ever run into a problem where you need to filter an Eloquent model by a relationship of a relationship and also eager load both of those rel...

Read more

Eloquent under the hood: where is the where method?

2 months ago

When you look through the source code for the Model class, you might be surprised to find that the where method (along with other methods used to crea...

Read more