にIDを表示するにもかかわらず、私は若干の問題が生じています - 私は、次のエラーメッセージが受信しています:Missing required parameters for [Route: teachers.forums.show] [URI: teachers/forums/{forum}]
欠落必要なパラメータURL
を、私はこれが何を意味するか知っています。しかし、どこが間違っているのか分かりません。私は明らかに何かを見過ごしている。私は他の同様の質問に投稿されたものを試しましたが、役に立たないものです。
URLはURLに正しく表示されます(例:教師/フォーラム/ 91。私は$フォーラムに対してデータを持っています - それ以外のものはすべてインデックスページに印刷されており、前述のようにIDはURLに目に見える形で付加されています。
routes.phpの
Route::group(['prefix' => 'forums'], function() {
Route::get('/dashboard', ['as' => 'teachers.forums.dashboard', 'uses' => '[email protected]']);
Route::get('/', ['as' => 'teachers.forums.index', 'uses' => '[email protected]']);
Route::post('/', ['as' => 'teachers.forums.add', 'uses' => '[email protected]']);
// route not working properly!
Route::get('/{forum}', ['as' => 'teachers.forums.show', 'uses' => '[email protected]']);
});
ビュー(blade.php)ヘルプは次のようになり
<a href="{{route('teachers.forums.show', $forum->id)}}" class="load_more_post">
<i class="fa fa-angle-right load-right-angle" aria-hidden="true"></i>
</a>
コントローラ
public function show(Forum $forum)
{
$teacher = User::getTeacher($this->selectedClass->id);
$forumQuestionMessages = ForumQuestion::getQuestions($forum);
return view('teachers.forums.show', compact('teacher', 'forum', forumQuestionMessages'));
}
感謝!!
試してみてください。私はそれをddと取得し、id - データベースにもレコードを持っています。 –
'ForumsController @ show'メソッドのパラメータの署名を質問に追加できますか? 'public function show(......)'のようなもの – ljubadr
確かに - 私は –