【发布时间】:2017-03-31 17:11:45
【问题描述】:
我需要更新一些记录,这是我刀片中的表单操作
<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'=>'ProjectCollaboratorsController@update',]);
当点击更新按钮时产生以下错误
Undefined variable: project (View: C:\Users\Nalaka\Desktop\c\resources\views\collaborators\permissionedit.blade.php)
如何解决这个问题?
【问题讨论】:
-
我没有看到你在这里尝试使用项目变量的位置。
-
检查我的表单操作