Autostart docker app unless stopped on purpose. Update README.md and describe cron scheduling. Add chart to product view and sort product prices.
This commit is contained in:
@@ -8,7 +8,11 @@ final class ProductController extends BaseController
|
||||
{
|
||||
public function __invoke(int $productId): void
|
||||
{
|
||||
$product = Product::with('price')->find($productId);
|
||||
$this->twig->display('product.html.twig', ['product' => $product ?? []]);
|
||||
$product = Product::with([
|
||||
'price' => fn($query) => $query->orderBy('created_at', 'desc')
|
||||
])->find($productId);
|
||||
$priceList = $product->price()->pluck('price')->implode(',');
|
||||
$priceDates = $product->price()->pluck('created_at')->map(fn($date) => $date->format('Y-m-d'))->implode("','");
|
||||
$this->twig->display('product.html.twig', ['product' => $product ?? [], 'price_list' => $priceList, 'price_dates' => $priceDates]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user