【发布时间】:2018-05-17 14:52:11
【问题描述】:
我正在尝试为我的发票页面获取数据,其中我针对单个发票编号使用了许多附加行。我获取了数据,但问题是我无法在发票视图页面中显示附加的行。应该写什么查询以获得预期的结果,有人可以帮我吗? 我的数据库表是-
在我的控制器中,我尝试了类似的操作-
public function orderProformaInvoiceDetails($poi)
{
$orderProformaInvoiceDetails = OrderProformaInvoice::where('opi_id', $poi)
->with('buyer', 'buyerJobs', 'buyerOrders')
->groupBy('invoice_no')
->orderBy('created_at', 'DESC')
->get();
return view('admin.marchendaising.order-proforma-invoices.details', compact('orderProformaInvoiceDetails'));
}
【问题讨论】:
-
你有什么错误吗?或者您尝试过的方法有什么问题?
-
我想显示许多
Style NameDescriptionFabricsQuantityUnit PriceTotal Price作为发票,就像我在创建发票期间所做的那样。 -
你为什么使用
groupBy()?您的视图是否应该每个invoice_no有一行? -
每个
invoice_no有很多行,这就是我需要groupBy()的原因,我想将'unit_price`、quantity、total_price显示为每个invoice_no的行。
标签: php mysql sql laravel eloquent