Laravel conditioned relationships and its danger zone

A little less known fact about Laravel relationships is that you can make them conditioned. This means, that you can extend the relationships to have a default condition already assigned to them. For example, you want to take latest entries or order them by likes count by default. Here’s a quick guide on how to do that

Continue reading Laravel conditioned relationships and its danger zone