정의되지 않은 변수가 오류를 발생시킵니다. 어떻게해야합니까? ForumController :정의되지 않은 변수 : 포럼
public function index()
{
$forums = Forum::all();
return view('forum.index') -> withForum($forums);
}
경로 :
Route::resource('/forum','ForumController');
welcome.blade :
@foreach($forums as $forum)
<div class="col-md-7">{{ $forum->title }}</div>
<div class="col-md-5 text-center">
<span class="label label-warning">پاسخ : ۱۰</span>
<span class="label label-primary">تشکر : ۱۰</span>
<span class="label label-success">RaymondDragon</span>
</div>@endforeach
ErrorException :
Undefined variable: forums (View: /opt/lampp/htdocs/forums/resources/views/welcome.blade.php)
당신이 – lagbox
너무 감사'welcome'보기를 반환하지 않습니다 당신이 여기 가지고 ... 잘못된 경로 및 컨트롤러를 보이고있다 ... 나는 노력 할게요 그리고 나는를 발표합니다 결과. – RaymondDragon
당신의'forum.index' 뷰는 'includes'를 포함 할 수 있습니까? – lagbox