protected function addConditions($query, $conditions)
    {
        foreach ($conditions as $key => $value) {
            if ($value instanceof Closure) {
                $query->where(function ($query) use ($value) {
                    $value($query);
                });
            } else {
                $this->addWhere($query, $key, $value);
            }
        }

        return $query;
    }
protected function addConditions($query, $conditions)
    {
        foreach ($conditions as $key => $value) {
            if ($value instanceof Closure) {
                $query->where(function ($query) use ($value) {
                    $value($query);
                });
            } else {
                $this->addWhere($query, $key, $value);
            }
        }

        return $query;
    }
protected function addConditions ( $ query , $ conditions ) { foreach ( $ conditions as $ key => $ value ) { if ( $ value instanceof Closure ) { $ query -> where ( function ( $ query ) use ( $ value ) { $ value ( $ query ) ; } ) ; } else { $ this -> addWhere ( $ query , $ key , $ value ) ; } } return $ query ; }
Add the given conditions to the query.

@param  \Illuminate\Database\Query\Builder  $query
@param  array  $conditions
@return \Illuminate\Database\Query\Builder
Add the given conditions to the query .