I'm having a problem with my query.
I want to filter through all Orders where user_id is the authenticated user. And run the searchquery on field number1 and field number2.
Query:
$query = Order::query();
$query->where('user_id', Auth()->id())
->where('number','LIKE', '%' . $searchquery . '%')
->orWhere('number2,'LIKE', '%' . $searchquery . '%')
->with('user');
I want to ALWAYS check where user_id is Auth()->id()
;
But when i run this orWhere it also gets orders from other users.
Thanks in advance.