Fixed filtering by categories.
This commit is contained in:
@@ -45,7 +45,7 @@ if (isset($_GET['product_id'])) {
|
|||||||
}
|
}
|
||||||
if (isset($_GET['category'])) {
|
if (isset($_GET['category'])) {
|
||||||
echo "<a href='/browser.php'>back</a><table class='table table-hover'>";
|
echo "<a href='/browser.php'>back</a><table class='table table-hover'>";
|
||||||
$products = Product::with('price')->fromRaw('products, json_each(products.categories)')->whereRaw('json_each.value = ?', [$_GET['category']])->get();
|
$products = Product::with('price')->selectRaw('products.*')->fromRaw('products, json_each(products.categories)')->whereRaw('json_each.value = ?', [$_GET['category']])->get();
|
||||||
echo "<table class='table table-hover'>";
|
echo "<table class='table table-hover'>";
|
||||||
foreach ($products as $product) {
|
foreach ($products as $product) {
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user