src/Handler.php
protected function formatParam($key, $value)
    {
        $supportedFixes = [
            'lt'     => '<',
            'gt'     => '>',
            'lte'    => '<=',
            'gte'    => '>=',
            'lk'     => 'LIKE',
            'not-lk' => 'NOT LIKE',
            'in'     => 'IN',
            'not-in' => 'NOT IN',
            'not'    => '!=',
        ];

        $prefixes = implode('|', $supportedFixes);
        $suffixes = implode('|', array_keys($supportedFixes));

        $matches = [];

        // Matches every parameter with an optional prefix and/or postfix
        // e.g. not-title-lk, title-lk, not-title, title
        $regex = '/^(?:('.$prefixes.')-)?(.*?)(?:-('.$suffixes.')|$)/';

        preg_match($regex, $key, $matches);

        if (! isset($matches[3])) {
            if (Str::lower(trim($value)) == 'null') {
                $comparator = 'NULL';
            } else {
                $comparator = '=';
            }
        } else {
            if (Str::lower(trim($value)) == 'null') {
                $comparator = 'NOT NULL';
            } else {
                $comparator = $supportedFixes[$matches[3]];
            }
        }

        $column = isset($matches[2]) ? $matches[2] : null;

        return compact('comparator', 'column', 'matches');
    }
protected function formatParam($key, $value)
    {
        $supportedFixes = [
            'lt'     => '<',
            'gt'     => '>',
            'lte'    => '<=',
            'gte'    => '>=',
            'lk'     => 'LIKE',
            'not-lk' => 'NOT LIKE',
            'in'     => 'IN',
            'not-in' => 'NOT IN',
            'not'    => '!=',
        ];

        $prefixes = implode('|', $supportedFixes);
        $suffixes = implode('|', array_keys($supportedFixes));

        $matches = [];

        // Matches every parameter with an optional prefix and/or postfix
        // e.g. not-title-lk, title-lk, not-title, title
        $regex = '/^(?:('.$prefixes.')-)?(.*?)(?:-('.$suffixes.')|$)/';

        preg_match($regex, $key, $matches);

        if (! isset($matches[3])) {
            if (Str::lower(trim($value)) == 'null') {
                $comparator = 'NULL';
            } else {
                $comparator = '=';
            }
        } else {
            if (Str::lower(trim($value)) == 'null') {
                $comparator = 'NOT NULL';
            } else {
                $comparator = $supportedFixes[$matches[3]];
            }
        }

        $column = isset($matches[2]) ? $matches[2] : null;

        return compact('comparator', 'column', 'matches');
    }
protected function formatParam ( $ key , $ value ) { $ supportedFixes = [ 'lt' => '<' , 'gt' => '>' , 'lte' => '<=' , 'gte' => '>=' , 'lk' => 'LIKE' , 'not-lk' => 'NOT LIKE' , 'in' => 'IN' , 'not-in' => 'NOT IN' , 'not' => '!=' , ] ; $ prefixes = implode ( '|' , $ supportedFixes ) ; $ suffixes = implode ( '|' , array_keys ( $ supportedFixes ) ) ; $ matches = [ ] ; // Matches every parameter with an optional prefix and/or postfix // e.g. not-title-lk, title-lk, not-title, title $ regex = '/^(?:(' . $ prefixes . ')-)?(.*?)(?:-(' . $ suffixes . ')|$)/' ; preg_match ( $ regex , $ key , $ matches ) ; if ( ! isset ( $ matches [ 3 ] ) ) { if ( Str :: lower ( trim ( $ value ) ) == 'null' ) { $ comparator = 'NULL' ; } else { $ comparator = '=' ; } } else { if ( Str :: lower ( trim ( $ value ) ) == 'null' ) { $ comparator = 'NOT NULL' ; } else { $ comparator = $ supportedFixes [ $ matches [ 3 ] ] ; } } $ column = isset ( $ matches [ 2 ] ) ? $ matches [ 2 ] : null ; return compact ( 'comparator' , 'column' , 'matches' ) ; }
Format the paramenter for query builder.

@param  string $key
@param  string $value
@return array
Format the paramenter for query builder .