-1
ステータスコメントを削除します。
マイroute
:動作していますが、laravelのリンクページをリダイレクトしません。5.2
Route::get('/delete-comment/{id}/', [
'uses' => '[email protected]',
'as' => 'Comment.delete',
'middleware' => 'auth'
]);
マイcontroller
:
public function getDeleteComment(Request $request,$id)
{
$class_id = $request->get('class_id');
$comment = StatusComments::where('id', $id)->first();
$comment->delete();
Flash::success('Successfuly deleted your comment!');
return redirect(route('class',['class_id'=>$class_id]));
}
マイ削除リンク:
<a href="{{ route('Comment.delete', ['id' => $comment->id]) }}" ><i class="fa fa-trash"></i></a>
私はそれは私にエラーを与えるのですopptionをクリックし削除します。私のリンクgenerate http://localhost:8000/classしかしここに来るべきであるhttp://localhost:8000/class/69。ここで、69は教室のテーブルIDによって生成されたページリンクです。だから、私はすでにステータス表にclass_idフィールドを挿入しています。
これはエラーです。..方法ライト\ View \ View :: __ toString()は例外をスローしてはいけません。 – Shuvo
このエラーはいつ表示されますか?削除時またはそれ以前? – jaysingkar
私のクラスのページで....私はそれをリロードします。 – Shuvo