我需要更新一些記錄,這是形式的行動,我的刀片如何解決未定義的變量在Laravel 5.2
<form class="form-vertical" role="form" method="post" action="/projects/{{ $project->id }}/collaborators/{{ $collaborator->user()->first()->id }}">
我控制器
public function update(Request $request, $projectId, $collaboratorId)
{
$this->validate($request, [
'status' => 'required',
]);
DB::table('permissions')
->where('project_id', $projectId)
->where('collaborator_id', $collaboratorId)
->update(['status' => $request->input('status')]);
return redirect()->back()->with('info','Your Permission has been updated successfully');
}
路線
Route::put('projects/{projects}/collaborators/{id}',['uses'=>'[email protected]',]);
當點擊更新按鈕生成如下錯誤
Undefined variable: project (View: C:\Users\Nalaka\Desktop\c\resources\views\collaborators\permissionedit.blade.php)
如何解決這個問題?
我沒有看到你試圖在這裏使用項目變量。 –
檢查我的表單動作 – Fernando