Skip to content

v5.5.2

@ahmdadl ahmdadl tagged this 30 Oct 14:26
Rebuilding a cached record with new $modelClass($payload) routes every
attribute through fill()/setAttribute (guard checks, mutators, per-attribute
date parsing). Benchmarked at ~0.1ms per attribute, this made cache hits
6-16x slower than the direct DB query for wide models like Category/Brand.

Reconstruct the model the same way Eloquent builds models coming from the
database (newFromBuilder): empty instance + setRawAttributes($payload, true)
+ exists = true. Identical toArray(), casts and originals, at ~0.02ms.

Adds a regression test pinning DB-equivalent hydration semantics, including
round-trip of a non-fillable raw attribute that the fill() path dropped.
Assets 2
Loading