
Define Casts in a Query
Laravel has Eloquent attribute and custom casting. But did you know about query-time casting? It's documented in Laravel, and illustrated beautifully by Aaron Francis.
Eloquent
Laravel has Eloquent attribute and custom casting. But did you know about query-time casting? It's documented in Laravel, and illustrated beautifully by Aaron Francis.
I write code blocks down that I know I won't use often and will forget about. Every so often I go through them to refresh my memory.
Prior to this simple PR, we needed verbose closures to do simple queries on relationships. Now it can be done on one line with these simple helpers.
Creates the whereRelation() and orWhereRelation() helpers, and whereMorphRelation() and orWhereMorphRelation() for morph relations.
This week's 8.53.0 release includes new "immutable_date" and "immutable_datetime" casts for Eloquent!
In the latest version of Laravel 8, Eloquent models now come with a Prunable and MassPrunable trait to automatically delete models based on criteria.
This pull request to the Laravel framework provides a solution for creating one-to-one relations that are a partial relation of a one-to-many relation.
In this article we're going to explore how to order database queries by the value (column) of an Eloquent relationship.
Use subqueries in Laravel to optimize your database selects.
I gave a talk on this topic at LaraconAU, 2019. It covers all the ways custom collections can improve your systems design and contains some more guidance on when you would reach for this pattern.