QueryBuilderParser icon indicating copy to clipboard operation
QueryBuilderParser copied to clipboard

append new group of conditions

Open starking8b opened this issue 2 years ago • 1 comments

hello , I am trying to append a new group of conditions in the background and in this group, I want to use OR and the relation between this group and the group that was submitted by the user will be AND so this is how it will work group1 which is submitted by a user group 2 which I want to add in the background the relation between group1 and group2 is AND and the conditions in group2 are OR how can I do that? how can I push my conditions in the condition that the customer has been sent?

starking8b avatar Sep 27 '22 08:09 starking8b

use it

            $table = \DB::table('clients');
            $table->select(\DB::raw($request_fields));
            $table->leftjoin('companies', 'clients.company_id', 'companies.id');
            $table->leftjoin('statuses', 'clients.status_id', 'statuses.id');
            $table->where('clients.project_id', '=', $settings['project_id']);

            $table->where(function ($query) use($condition){
                $qbp = new QueryBuilderParser();
                $query = $qbp->parse($condition, $query);
            });
            
            $clients=$table->get();

geo903 avatar Oct 21 '23 13:10 geo903