korridor/laravel-computed-attributes
Adds “computed attributes” to Laravel models, letting you define dynamic/derived properties that behave like normal attributes (including access/casting/serialization) without storing them in the database. Useful for clean model APIs and reusable calculations.
Breaking
The version 3.0.0 is only compatible with Laravel 10. If you want to use this package with an older Laravel version, you can still use the 2.2.* versions. (See README for installation instructions)
Changes
Thanks to a PR from @Onatcer, the command computed-attributes:generate now only saves the model if the recalculated computed property changed the model (checked with $model->isDirty()).
Full Changelog: https://github.com/korridor/laravel-computed-attributes/compare/v1.0.1...v2.0.0
New
artisan computed-attributes:validate)->with('...') for better performance)Fixes
How can I help you explore Laravel packages today?