我试图通过检索我的订单表中的数据来获取发票,但是当我单击链接时,它会带我返回我的订单页面,而无需执行任何操作。
OrdersController.php
public function getPdf(Order $order)
{
if (auth()->id() != $order->user_id) {
return back()->withError("Vous n'avez pas accès à cette commande");
}
$products = $order->products;
$member = User::find(Auth::id());
$categories = Category::all();
$pdf = PDF::loadview('invoice/invoice');
return $pdf->download('invoice.pdf')->with([
'order' => $order,
'products' => $products,
'member' => $member,
'categories' => $categories,
]);
}
网站.php
Route::get('/invoice', 'OrdersController@getPdf');
有人能帮我吗?谢谢
海绵宝宝撒