-1
我已經創建了一些產品,當我點擊其中一個產品時,我想展示此產品的更多信息,如何在laravel 5中執行此操作?如何將對象從視圖傳遞給另一個laravel 5
我已經創建了一些產品,當我點擊其中一個產品時,我想展示此產品的更多信息,如何在laravel 5中執行此操作?如何將對象從視圖傳遞給另一個laravel 5
ü需要用行動展現在ProductController的,並通過ID
public function show($id)
{
$product= Product::findOrFail($id);
return View('product.show')->with('product',$product);
}
現在
鑑於使鏈接,你寄的產品你的ID
<a href="{{ action('[email protected]', [$product->id]) }}">{{ $product->name}}</a>
然後在你的節目中查看通話atributes PROM選擇產品
<h3>{!! $product->name!!}</h3>
<h3>{!! $product->price!!}</h3>
...
請按照help-> tour的說明,在您的帖子中忽略chit-chat(「thanks!」)。 – Anthon