Increase speed of processing the prices and products. Because this is getting out of hand.
This commit was merged in pull request #33.
This commit is contained in:
@@ -14,7 +14,7 @@ final class IndexController extends BaseController
|
||||
if ($this->cache->getItem('list_all')->isHit()) {
|
||||
return $this->render('productList.html.twig', ['listType' => 'all']);
|
||||
}
|
||||
$products = Product::with(['currentStock', 'price', 'lowestPrice'])
|
||||
$products = Product::with(['currentStock'])
|
||||
->orderByDesc('starred')
|
||||
->orderByDesc('created_by')
|
||||
->get();
|
||||
|
||||
@@ -16,7 +16,7 @@ final class PromosController extends BaseController
|
||||
return $this->render('productList.html.twig', ['listType' => 'promos']);
|
||||
}
|
||||
|
||||
$products = Product::whereHas('currentPrice', fn(Builder $query) => $query->whereColumn('price', '<', 'productStandardPrice'))
|
||||
$products = Product::whereRaw('priceCurrent < productStandardPrice')
|
||||
->orderByDesc('starred')
|
||||
->orderByDesc('created_by')
|
||||
->with(['currentPrice', 'lowestPrice'])
|
||||
|
||||
Reference in New Issue
Block a user