商品の詳細を知るために、シャツ。どうやってするか?私はここで Error's Message"タイプエラー:App Http Controllers FrontController :: detail()関数の引数が少なすぎると0が渡され、正確に1が返される"
若干の誤差はこの私のWebビューを持っている web View
FrontController.php
class FrontController extends Controller
{
public function index()
{
$shirts=Product::all();
return view('front.home', compact('shirts'));
}
public function shirts()
{
$shirts=Product::all();
return view('front.shirts', compact('shirts'));
}
public function detail($id)
{
return view('front.shirt', ['detail' => Product::findOrFail($id)]);
}
ルート Web.php
Route::get('/', '[email protected]')->name('home');
Route::get('/shirts', '[email protected]')->name('shirts');
Route::get('/detail', '[email protected]')->name('detail');
Shirts.blade.php
私はあなたにもidパラメータを与える必要があり、あなたのルートで考える210<a href="{{route('detail', $shirt->id)}}">
コメントは議論の対象外です。この会話は[チャットに移動]されています(http://chat.stackoverflow.com/rooms/161966/discussion-on-question-by-yudha-patria-type-error-to-few-arguments-to-functio) 。 –