protected function castParam($key, $value)
    {
        if (is_null($value) or ! $this->hasCast($key)) {
            return $value;
        }

        switch ($this->getCastType($key)) {
            case 'int':
            case 'integer':
                return (int) $value;
            case 'real':
            case 'float':
            case 'double':
                return (float) $value;
            case 'string':
                return (string) $value;
            case 'bool':
            case 'boolean':
                return (bool) $value;
            case 'array':
                return (array) $value;
            case 'collection':
                return collect((array) $value);
            default:
                return $value;
        }
    }
protected function castParam($key, $value)
    {
        if (is_null($value) or ! $this->hasCast($key)) {
            return $value;
        }

        switch ($this->getCastType($key)) {
            case 'int':
            case 'integer':
                return (int) $value;
            case 'real':
            case 'float':
            case 'double':
                return (float) $value;
            case 'string':
                return (string) $value;
            case 'bool':
            case 'boolean':
                return (bool) $value;
            case 'array':
                return (array) $value;
            case 'collection':
                return collect((array) $value);
            default:
                return $value;
        }
    }
protected function castParam ( $ key , $ value ) { if ( is_null ( $ value ) or ! $ this -> hasCast ( $ key ) ) { return $ value ; } switch ( $ this -> getCastType ( $ key ) ) { case 'int' : case 'integer' : return ( int ) $ value ; case 'real' : case 'float' : case 'double' : return ( float ) $ value ; case 'string' : return ( string ) $ value ; case 'bool' : case 'boolean' : return ( bool ) $ value ; case 'array' : return ( array ) $ value ; case 'collection' : return collect ( ( array ) $ value ) ; default : return $ value ; } }
Cast an param to a native PHP type.
@param  string  $key
@param  mixed  $value
@return mixed
Cast an param to a native PHP type .