rinvex / laravel-attributes

⚠️ [ABANDONED] Rinvex Attributable is a robust, intelligent, and integrated Entity-Attribute-Value model (EAV) implementation for Laravel Eloquent, with powerful underlying for managing entity attributes implicitly as relations with ease. It utilizes the power of Laravel Eloquent, with smooth and seamless integration.
MIT License
433 stars 104 forks source link

Significant performance improvement by bypassing Eloquent model magic #97

Closed simonworkhouse closed 4 years ago

simonworkhouse commented 5 years ago

When accessing Eloquent model attributes via $model->getAttribute(...) or $model->attribute, Eloquent will check if the attribute needs to be cast or mutated. This adds significant processing time when accessing attributes so instead we bypass this by calling $model->getAttributes()['attribute'] and casting it ourselves.

simonworkhouse commented 5 years ago

Sorry, this probably should have been a draft pull request as there is probably some discussion to be had whether or not we can ignore considerations for changes in casts or potential mutators.

simonworkhouse commented 4 years ago

@Omranic Any chance that this will be looked at?

batFormat commented 4 years ago

@Omranic, will be looked at?

Omranic commented 4 years ago

Merged, thank you! Further performance improvements, and / or test suites will be appreciated :)