@Respect hope this helps Product::where('category_id',$id)->where(function ($query) { $query->where('price_before','!=',0) ->orWhere('price_after','!=',0); })->paginate(10);
Mar 10, 2019
6
Level 3
Query Keeps return data if Match or doesn't match id
Query Keeps return data if Match or doesn't match id
// Api.php
Route::get('/products/category/{category}','ProductController@productsCategory');
public function ProductsCategory($id)
{
$products = Product::where('category_id', $id)
->where('price_before','!=',0)
->orWhere('price_after','!=',0)
->paginate(10);
return ProductCollect::collection($products);
}
If i write in broswer
--------------------------
http://127.0.0.1:8000/api/products/category/5
return products of category_id 5 // works
But If i wrote 4 or 3 or 2 or what ever in broswer link Keep Return the same data of category_id 5
What i Did
php artisan config:clear
php artisan cache:clear
php artisan route:clear
php artisan view:clear
Level 1
1 like
Please or to participate in this conversation.