1 回答
TA贡献1871条经验 获得超13个赞
创建 Invoice 的单个实例并用项目填充它。然后调用 ->show()... 不确定您是否需要 ->show() 方法,但您可以尝试使用它。
public function invoice($id)
{
$motorcycle_service = MotorcycleService::findOrFail($id);
$invoice = \ConsoleTVs\Invoices\Classes\Invoice::make()
->number($motorcycle_service->id)
->with_pagination(true)
->duplicate_header(true)
->date(Carbon::parse($motorcycle_service->created_date))
->notes('Expected date and time to complete: ' . Carbon::createFromFormat('Y-m-d H:i:s', $motorcycle_service->expected_date)->format('d/m/Y h:i a'))
->customer([
'name' => $motorcycle_service->motorcycle->customer->name,
'phone' => $motorcycle_service->motorcycle->customer->phone_no,
'id' => $motorcycle_service->motorcycle->customer->id,
'email' => $motorcycle_service->motorcycle->customer->email
]);
foreach ($motorcycle_service->items as $item){
$invoice->addItem($item->item->name, $item->item->price, $item->quantity, $item->id)
}
return $invoice->show($motorcycle_service->id);
}
- 1 回答
- 0 关注
- 188 浏览
添加回答
举报