Articles › Eloquent
TAG ARCHIVE

Everything on Eloquent.

15 articles tagged Eloquent, sorted newest first.

filament

Filament v5 Performance: Making a 100,000-Row Panel Feel Instant

Filament is wonderful at 500 rows and miserable at 500,000. Almost none of that is Filament's fault - here is the ordered method for finding which of the eight usual causes is actually yours.

17 min read →
laravel

Sort Users by Their Last Order Without an N+1: Eloquent Subquery Selects

An admin table needs a sortable Last ordered column. Eager loading fixes the query count but not the memory, and it cannot sort at all. The subquery select does both in four lines.

12 min read →
filament

Add Soft Deletes to a Filament v5 Resource: Trashed Filter, Restore and Force Delete

The scaffold flag only helps on a brand new resource. Here's the retrofit path for soft deletes on an existing Filament v5 resource — including the query override that fixes the 404 on a trashed record.

11 min read →
php

Switch Laravel to Immutable Dates with CarbonImmutable

Carbon extends DateTime, so every modifier rewrites the object you called it on. Here is how to move a Laravel app onto CarbonImmutable end to end.

7 min read →
debugging

Debug Livewire and Eloquent Faster with Spatie Ray

Stop halting requests with dd() and scribbling over pages with dump(). Spatie Ray sends Laravel debug output to a desktop app so you can watch queries, events and Livewire state live.

7 min read →
filament

Add Status Tabs with Counts to a Filament v5 List Page

Filament tables can be filtered, but the filter form hides behind a button. For a fixed set of states like order status, tabs put always-visible, counted query scopes right above the table.

8 min read →
laravel

Auto-Delete Stale Records with Laravel's Prunable Trait

Some tables only ever grow. Here's how Laravel's Prunable trait deletes stale rows on a schedule — safely, in chunks, with a hook for cleaning up related files.

6 min read →
filament

Build Custom Table Filters in Filament v4

Past SelectFilter and TernaryFilter: build a custom Filament v4 filter from a form schema and a query() callback, add a date range, and wire up indicators.

8 min read →
filament

Filament v4 Repeater & Builder: Edit Nested, Repeatable Form Data

Repeatable rows and block-based content in Filament v4 — store them in a JSON column or a HasMany relationship, read parent and sibling fields with $get, and stop nested rows saving empty.

9 min read →
laravel

Catch N+1 Queries Early with Eloquent Strict Mode

Turn N+1 queries into loud exceptions in development instead of silent latency in production. Here's what Eloquent strict mode does and exactly where to switch it on.

6 min read →
filament

Filament v4 Nested Resources: Editing Child Models in Parent Context Without RelationManagers

How to scaffold a Filament v4 nested resource that edits child models inside the parent's URL: with scoped queries, pre-filled foreign keys, and policies that hide forbidden actions.

10 min read →
filament

Filament v4 Many-to-Many Relation Managers: Pivot Fields, Attach, and Detach

How to surface pivot data in a Filament v4 relation manager: withPivot, AttachAction with form fields, scoped record selects, and a safe detach story.

10 min read →
php

Replacing String Constants with PHP Backed Enums in Laravel Models

String constants like STATUS_PENDING are typo-prone, unautocompleted, and impossible to enumerate exhaustively. PHP backed enums fix all of that: and Laravel has native support throughout.

5 min read →
php

PHP Readonly Classes as Value Objects in Laravel

Primitive obsession is one of those code smells that's easy to ignore: until you're debugging which integer is pounds and which is pence. PHP readonly classes fix that cleanly.

6 min read →
php

PHP 8.4 Property Hooks in Laravel Models

PHP 8.4 property hooks are a tidy language-level alternative to getters and setters: but before you reach for them in your Eloquent models, there's a catch worth understanding.

4 min read →