"welcome"ページから "profile"ページへのリンクで何がうまくいかないのか分かりません。Laravel不一致変数ビュー
奇妙なひもが、私は変数にを渡すことである
それは「::レストラン(ビュー/Users/beyerdynamic/Documents/Developer/dev1/resources/views/welcome.blade.php)未定義変数」と言います私の見解。
私をPagesControllerは次のとおりです。
@foreach($restaurants as $key => $restaurant)
<div class="col-md-4">
<div class="card">
<div class="image">
<img src="{{asset('images/frontend/profile/dummy/profilehero/hero4.png')}}" alt="..." />
<div class="filter filter-white">
<a href="{{ URL::to('profile/'.$restaurant->id)}}" type="button" class="btn btn-info btn-round btn-fill">
<i class="fa fa-heart"></i> View Restaurant
</a>
</div>
</div>
</div>
</div>
@endforeach
レストラン変数が私の歓迎ビューに適切に渡されますが、私は、リンクをクリックしたときにエラーが/ /プロファイルに発生します。
public function welcome() {
$restaurants = User::orderByRaw('RAND()')->take(3)->get();
return view('welcome')->withRestaurants($restaurants);
}
私のビューがあります{id} URL。
'プロファイル/ {ID}が何である'あなたはそれについて何も共有しませんでしたか? –
'Profile/{id}'と 'routes.php'のコントローラーコードを共有します –
@Iftikharuddin uddin:プロフィールのコントローラ/¥{id}にチェックされています。エラーがそこにありました。ありがとう – Mamulasa