public function __get($key) { // Dynamically retrieve the encrypted attribute $value = $this->getDynamicEncrypted($key); if (!is_null($value) || is_string($value)) { return $value; } // Default Eloquent dynamic getter return parent::__get($key); }