2 months ago

Multi Parameter in Search 'GET'

Posted 2 months ago by ethar

i try to make multi search parameter, i check if request->any have value or not, if have value shot match that value , if not should not append it in search

public function search(Request $request)
        $product = Products::select('id', 'cats_id', 'brands_id', 'name_ar', 'admins_id')
        if ($request->s !== null) {
            $product->where('name_ar', 'LIKE', "%{$request->s}%");
        if ($request->discount == '1') {
            $product->where('discount', '!=', null);
        return view('admin.product.indexproduct', compact('product'));

but not worked, all value returned, my condition ignored, plz how to do that.

Please sign in or create an account to participate in this conversation.