private function resolveCast($old, $desired, Model $model, &$transformed)
    {
        if ($desired instanceof Closure) {
            return $transformed[$old] = call_user_func($desired, $model);
        }

        if (is_string($desired) && strpos($desired, $this->functionSign) !== false) {
            return $transformed[$old] = call_user_func([$this, substr($desired, 1)], $model);
        }

        if (is_string($desired) && strpos($desired, $this->querySign) !== false) {
            return $this->parse($old, substr($desired, 1), $model, $transformed);
        }

        if (is_string($old)) {
            return $transformed[$desired] = $model->$old;
        }

        return $transformed[$desired] = $model->$desired;
    }
private function resolveCast($old, $desired, Model $model, &$transformed)
    {
        if ($desired instanceof Closure) {
            return $transformed[$old] = call_user_func($desired, $model);
        }

        if (is_string($desired) && strpos($desired, $this->functionSign) !== false) {
            return $transformed[$old] = call_user_func([$this, substr($desired, 1)], $model);
        }

        if (is_string($desired) && strpos($desired, $this->querySign) !== false) {
            return $this->parse($old, substr($desired, 1), $model, $transformed);
        }

        if (is_string($old)) {
            return $transformed[$desired] = $model->$old;
        }

        return $transformed[$desired] = $model->$desired;
    }
private function resolveCast ( $ old , $ desired , Model $ model , & $ transformed ) { if ( $ desired instanceof Closure ) { return $ transformed [ $ old ] = call_user_func ( $ desired , $ model ) ; } if ( is_string ( $ desired ) && strpos ( $ desired , $ this -> functionSign ) !== false ) { return $ transformed [ $ old ] = call_user_func ( [ $ this , substr ( $ desired , 1 ) ] , $ model ) ; } if ( is_string ( $ desired ) && strpos ( $ desired , $ this -> querySign ) !== false ) { return $ this -> parse ( $ old , substr ( $ desired , 1 ) , $ model , $ transformed ) ; } if ( is_string ( $ old ) ) { return $ transformed [ $ desired ] = $ model -> $ old ; } return $ transformed [ $ desired ] = $ model -> $ desired ; }
Resolves casts based on supplied array of arguments.

@param  string  $old
@param  string|Closure  $desired
@param  \Illuminate\Database\Eloquent\Model  $model
@param  array  &$transformed
@return array
Resolves casts based on supplied array of arguments .