Cast Eloquent attributes to backed PHP enums to replace magic strings with real types, and give your enums behavior with helper methods.
#Eloquent
Articles
Build a shared-database multi-tenant Laravel app from scratch using a tenant column, middleware, and a global scope that keeps every query isolated.
Query scopes let you name and reuse common Eloquent constraints so your controllers stay readable and your query logic lives in one place.
Eight practical Laravel patterns that make your code read more like intent and less like implementation — from fluent helpers to conditional chains.
Route model binding does more than inject a model. Custom keys, scoped bindings, soft-delete handling, and enums all hide behind this everyday feature.
These five underused Eloquent features will help you write less code, run fewer queries, and make your models a lot more pleasant to work with.