his is the correct way

// that skips mutators


getOriginal() doesn’t just skip mutators, it also returns the «original» value of the field at the time the object was read from the database. So if you have since modified the model’s property, this won’t return your modified value, it will still return the original value. The more consistent and reliable way to get the un-mutated value from within the model class is to retrieve it from the attributes property like this:


But be aware that attributes is a protected property, so you can’t do that from outside the model class. In that case, you can use


Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *

Любишь мемасики?

Подпишись на мой телеграм-канал!