3
私のコントローラにこの機能があります。Laravelクエリビルダはgetメソッドの変数を使用していません
public function tourList($country, $category)
{
$tour = Tour::whereHas('country', function($q) {
$q->where('name','=', $country);
})
->whereHas('category', function($r) {
$r->where('name','=', $category);
})
->get();
return view('tour-list.blade.php')->withTour('$tour');
}
getメソッドから2つの変数を渡しましたが、しかし、私はあなたのクエリのようになりwilllので、あなたは匿名関数でuse
が欠落している
Undefined variable: country
くれ – PassionInfinite
ルート@zacharyDaleルート・パスを表示::取得( 'tour/{country}/{categpry}'、['as' => 'tour.list'、 'uses' => 'PublicController @ tourList']); –
これは私のルートです –