I'm currently available for full time hire! Inquire Here

Category: Eloquent

Community Eloquent Laravel

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.

laravel-news.com

698 clicks
698 views

Blade Eloquent Snippets Laravel Series: Laravel Snippets

10 Random Laravel Snippets & Methods, Part 4

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.

Anthony Rappa Anthony Rappa

Anthony Rappa

2 min read
4,793 views

Laravel Eloquent

Refactoring with Laravel's new whereRelation methods

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.

Anthony Rappa Anthony Rappa

Anthony Rappa

1 min read
9,195 views

Community Eloquent Laravel

[8.x] Adds a simple where helper for querying relations

Creates the whereRelation() and orWhereRelation() helpers, and whereMorphRelation() and orWhereMorphRelation() for morph relations.

github.com

1,759 clicks
1,759 views

Community Eloquent Laravel

Immutable dates in Laravel

This week's 8.53.0 release includes new "immutable_date" and "immutable_datetime" casts for Eloquent!

dyrynda.com.au

1,595 clicks
1,595 views

Laravel Eloquent

Pruning Laravel Models

In the latest version of Laravel 8, Eloquent models now come with a Prunable and MassPrunable trait to automatically delete models based on criteria.

Anthony Rappa Anthony Rappa

Anthony Rappa

1 min read
7,555 views

Community Laravel Eloquent Database

Laravel one-of-many relationships

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.

github.com

1,467 clicks
1,467 views

Community Laravel Eloquent

Ordering database queries by relationship columns in Laravel

In this article we're going to explore how to order database queries by the value (column) of an Eloquent relationship.

reinink.ca

1,610 clicks
1,610 views

Community Laravel Eloquent

Dynamic relationships in Laravel using subqueries

Use subqueries in Laravel to optimize your database selects.

reinink.ca

1,412 clicks
1,412 views

Community Laravel Eloquent

Giving collections a voice

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.

timacdonald.me

1,335 clicks
1,335 views