title = "Order detail" url = "/order-detail/:orderId" layout = "platform_main" is_hidden = 0 [orderItem] == param("orderId"); $orderId = $this->param("orderId"); $count = Romanah\Gokbakja\Models\OrderItem::where("order_id", $orderId)->count(); $this["order"] = Romanah\Gokbakja\Models\Order::where("id", $orderId) ->withCount(['order_items as order_all_amount' => function($query) { $query->select(DB::raw('sum(amount)')); }]) ->withCount(['order_items as order_all_price' => function($query) { $query->select(DB::raw('sum(price)')); }]) ->first(); $this["all"] = ($this["order"]->order_all_amount * $this["order"]->order_all_price) / $count; $this["orderItems"] = Romanah\Gokbakja\Models\OrderItem::where("order_id", $orderId)->orderBy("id", "DESC")->with(["type", "size", "color"])->get(); $this["sizes"] = Romanah\Gokbakja\Models\BagSize::get(); $this["types"] = Romanah\Gokbakja\Models\BagType::get(); $this["colors"] = Romanah\Gokbakja\Models\BagColor::get(); } ?> == {% put styles %} {% endput %}