Description
Currently the eloquent model class contains a cache strategy for getters which first fetches all class methods and runs a loop on them filtering them by a regular expression.
This occurs only once per unique eloquent final object.
The getter cache container is only filled up with the processed snake case attribute key.
Each time a new model class is created for first time a loop with 50 to 100 iterations with processing a regular expression is run.
Wouldn't it be cool to have something like php artisan eloquent:cache
for this ?
Also the method name can be saved in the mutator cache container, which prevents further string processing (for fetching method name from a given attribute) as both attribute name and the getter method name exist in the cache array.
$mutatedAttributes[$method] = lcfirst($matches[1]);