Articles Eloquent
TAG ARCHIVE

Everything on Eloquent.

11 articles tagged Eloquent, sorted newest first.

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