public static function PopulateOrderDetailViewModel($order) { $model = new OrderDetailViewModel(); $model->id = $order->order_id; $model->branch_name = BranchService::GetById($order->branch_id)->name; $model->date_order = $order->date_order->format('Y-m-d H:i:s'); $model->status_name = Statusorder::find(['statusorder_id' => $order->statusorder_id])->name; $model->account_name = AccountService::GetById($order->account_id)->account_name; $model->products = OrderListService::GetProductsByOrderId($order->order_id); return $model; }