src/User/User.php
public function getPreferencesAttribute($value)
    {
        $defaults = array_map(function ($value) {
            return $value['default'];
        }, static::$preferences);

        $user = array_only((array) json_decode($value, true), array_keys(static::$preferences));

        return array_merge($defaults, $user);
    }
public function getPreferencesAttribute($value)
    {
        $defaults = array_map(function ($value) {
            return $value['default'];
        }, static::$preferences);

        $user = array_only((array) json_decode($value, true), array_keys(static::$preferences));

        return array_merge($defaults, $user);
    }
public function getPreferencesAttribute ( $ value ) { $ defaults = array_map ( function ( $ value ) { return $ value [ 'default' ] ; } , static :: $ preferences ) ; $ user = array_only ( ( array ) json_decode ( $ value , true ) , array_keys ( static :: $ preferences ) ) ; return array_merge ( $ defaults , $ user ) ; }
Get the values of all registered preferences for this user, by
transforming their stored preferences and merging them with the defaults.

@param string $value
@return array
Get the values of all registered preferences for this user by transforming their stored preferences and merging them with the defaults .