public function juggle($value, $type)
    {
        // Cast non-null values
        if ( ! is_null($value)) {
            // Ensure that the type is a valid type to cast.
            // We do this check here because it might not have been done
            // as is the case when the model is first initialized.
            if ($this->checkJuggleType($type)) {
                // Get the method that the type maps to
                $method = $this->buildJuggleMethod($type);

                // Cast the value to the type using the method
                $value = $this->{$method}($value);
            }
        }

        return $value;
    }
public function juggle($value, $type)
    {
        // Cast non-null values
        if ( ! is_null($value)) {
            // Ensure that the type is a valid type to cast.
            // We do this check here because it might not have been done
            // as is the case when the model is first initialized.
            if ($this->checkJuggleType($type)) {
                // Get the method that the type maps to
                $method = $this->buildJuggleMethod($type);

                // Cast the value to the type using the method
                $value = $this->{$method}($value);
            }
        }

        return $value;
    }
public function juggle ( $ value , $ type ) { // Cast non-null values if ( ! is_null ( $ value ) ) { // Ensure that the type is a valid type to cast. // We do this check here because it might not have been done // as is the case when the model is first initialized. if ( $ this -> checkJuggleType ( $ type ) ) { // Get the method that the type maps to $ method = $ this -> buildJuggleMethod ( $ type ) ; // Cast the value to the type using the method $ value = $ this -> { $ method } ( $ value ) ; } } return $ value ; }
Cast the value to the attribute's type as specified in the juggable array.

@param mixed  $value
@param string $type

@throws InvalidArgumentException

@return mixed
Cast the value to the attribute s type as specified in the juggable array .