storm
storm copied to clipboard
Update our override of Laravel's attributesToArray()
- Use base Model methods instead of re-implementing them ourselves.
- Add our before/after events.
- Handle model's
$jsonablearray since Laravel doesn't seem to handle this. - Using base model
addCastAttributesToArray()also adds casting types not supported before:- date:<format>
- datetime:<format>
Note: in order for created_at/updated_at columns to be used in $casts, the model's $timestamps property needs to be false.
Summary by CodeRabbit
-
Refactor
- Consolidated internal attribute transformation logic into dedicated helper routines to improve maintainability and reliability.
-
Tests
- Added coverage verifying date and cast handling to ensure attribute serialization behaves as expected.
Note: No user-facing changes or public API updates in this release.
✏️ Tip: You can customize this high-level summary in your review settings.