All products menu link
This commit is contained in:
@@ -19,6 +19,7 @@ class AppExtension extends AbstractExtension
|
||||
{
|
||||
return [
|
||||
new TwigFunction('promosCount', [$this, 'promosCount']),
|
||||
new TwigFunction('allCount', [$this, 'allCount']),
|
||||
new TwigFunction('newCount', [$this, 'newCount']),
|
||||
new TwigFunction('discontinuedCount', [$this, 'discontinuedCount']),
|
||||
];
|
||||
@@ -30,10 +31,14 @@ class AppExtension extends AbstractExtension
|
||||
new TwigFilter('findByCreatedAtDate', [$this, 'findByCreatedAtDate']),
|
||||
];
|
||||
}
|
||||
public function allCount(): int
|
||||
{
|
||||
return Product::count();
|
||||
}
|
||||
|
||||
public function promosCount(): int
|
||||
{
|
||||
return Product::whereHas('currentPrice', fn(Builder $query) => $query->whereColumn('price', '<', 'productStandardPrice'))->with(['currentPrice'])->count();
|
||||
return Product::whereHas('currentPrice', fn(Builder $query) => $query->whereColumn('price', '<', 'productStandardPrice'))->count();
|
||||
}
|
||||
|
||||
public function newCount(): int
|
||||
|
||||
Reference in New Issue
Block a user