我要更新我的权限表值。
这是控制器功能
public function edit($project,$id)
{
$projectId=Project::findOrFail($project, ['id'])->id;
$permissions = Permission::permissioneditt($id,$projectId)->get();
view('collaborators.permissionedit')->withPermissions($permissions);
return view('collaborators.permissionedit', compact('permissions', 'projectId','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');
}
这是更新表格
<form class="form-vertical" role="form" method="post" action="{{url('projects/' .$projectId .'/collaborators/' . $collaboratorId.'}}">
<div class="form-group{{ $errors->has('status') ? ' has-error' : '' }}">
<label for="status" class="control-label">Choose Permission</label>
<select name="status" id="status">
<option value="{!! $permission->status !!}">{!! $permission->status !!}</option>
<option value="3">3</option>
<option value="2">2</option>
<option value="1">1</option>
{{ getStatus($permission->status) }}
</select>
@if ($errors->has('status'))
<span class="help-block">{{ $errors->first('status') }}</span>
@endif
{{-- {{$permission->project_id}} --}}
</div>
<div class="form-group">
<button type="submit" class="btn btn-info">Update</button>
</div>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
{!! method_field('PUT') !!}
</form>
这是路线
Route::put('projects/{projects}/collaborators/{id}',['uses'=>'ProjectCollaboratorsController@update',]);
但是当我点击更新按钮时会生成以下错误
FatalErrorException in 607c064f09cf795b94deb14e18a3a34650c521d0.php line 23: syntax error, unexpected 'status' (T_STRING)
我该如何解决这个问题?