控制器:
public function edit(Request $request, Posts $posts) {
$validatedRequests = $request->validate([
'title' => 'required|max:255|string|integer',
'description' => 'required|max:255|string|integer',
'price' => 'required|integer|max:255|'
]);
$posts->update([
'title' => $request->title,
'description' => $request->description,
'price' => $request->price
]);
$posts->save();
*return redirect(route('singelPost', ['post'=> $posts->id]))->with('mssg', 'updates successfully');*
}
web.php:
Route::get('/post/{post:id}', [PostController::class, 'show'])->name('singlePost');
这就是我得到的错误:* 缺少[Route:显示编辑表单] [URI:post/{post}/editForm] [缺少参数:邮件].*
1条答案
按热度按时间yfwxisqw1#
您是否犯了错误的代码/语法?请尝试以下操作: