jeudi 2 août 2018

Laravel Query Fetch Wrong Data

I have written Laravel Search Query.

$product = Product::where('user_role_id', '=', 3)
                           ->where('user_id', '!=', $user_id)
                           ->where('quantity_in_stock', '>', 0);
                if (!empty($suggestion)) {
                    $product->where('product_name', 'like', '%' . $suggestion . '%')->orWhere('ndc_number', 'like', '%' . $suggestion . '%');
                }
                $search = $product->orderby('id', 'desc')->get();
                $products = $search->toArray();

But my issue is that when I am looking search result I found such results which have user_role_id => 2 But in query I have given equal to 3.

Can any help to sort out this issue.

Thanks



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Aw291O
via IFTTT

Aucun commentaire:

Enregistrer un commentaire