To optimize Role object, its permission values wont be created unless manually get. I have tested this to lower the memory usage from 20 MB to 18 MB and faster init time in my Bot.
Also a new practice that should be done: When there is a fillable that is handled with custom attribute mutator, the method should be called instead of the magic property, right now this should only apply to the same class
e.g. $this->icon_hash is override by $this->getIconHashAttribute() so the Role class should always use $this->getIconHashAttribute() instead of the $this->icon_hash. Does not apply to object instances e.g. $role->icon_hash should stay.
To optimize Role object, its permission values wont be created unless manually get. I have tested this to lower the memory usage from 20 MB to 18 MB and faster init time in my Bot.
Also a new practice that should be done: When there is a fillable that is handled with custom attribute mutator, the method should be called instead of the magic property, right now this should only apply to the same class e.g.
$this->icon_hash
is override by$this->getIconHashAttribute()
so theRole
class should always use$this->getIconHashAttribute()
instead of the$this->icon_hash
. Does not apply to object instances e.g.$role->icon_hash
should stay.Not fully tested.