0

I want to write more than one condition where in controller. How can I solve this? For example :

$query = $query->where(function ($q,$request) { $q->where('product_name', 'like', '%'.$request->get('q').'%')->orWhere('product_id','like', '%'.$request->get('q').'%')->get();});

1 Answers1

0
 $result = User::where(function($query) use ($search) {
                $query->orWhere('product_name', 'LIKE', "%{$search}%")
                ->orWhere('product_id', 'LIKE', "%{$search}%");
            })->get();

I hope it would work for you.

Ankita Dobariya
  • 823
  • 5
  • 14