ORT-Interactive-GmbH / laravel-couchbase

A Couchbase based Eloquent model and Query builder for Laravel
40 stars 26 forks source link

Problem with "whereDate" #1

Closed spresnac closed 6 years ago

spresnac commented 7 years ago

"whereDate" uses the mysql "date" command, what is unknown to Couchbase. Here's a workaround for "Builder.php", adding this 2 function made it quick and dirty working. Please provide a clean working soloution, thanks ;)

protected function addDateBasedWhere($type, $column, $operator, $value, $boolean = 'and')
    {
        $this->wheres[] = compact('column', 'type', 'boolean', 'operator', 'value');

        $this->addBinding($value, 'where');

        return $this;
    }

    public function whereDate($column, $operator, $value = null, $boolean = 'and')
    {
//        list($value, $operator) = $this->prepareValueAndOperator(
//            $value, $operator, func_num_args() == 2
//        );
        return $this->addDateBasedWhere('DATE_FORMAT_STR', $column, $operator, $value, $boolean);
    }