I am going to update My permission table value.
this is controlller function
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'));
}
and this is update function
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');
}
this is update form
<form class="form-vertical" role="form" method="post" action="">
<div class="form-group">
<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>
</select>
@if ($errors->has('status'))
<span class="help-block"></span>
@endif
--}}
</div>
<div class="form-group">
<button type="submit" class="btn btn-info">Update</button>
</div>
<input type="hidden" name="_token" value="">
{!! method_field('PUT') !!}
</form>
and this is routes
Route::put('projects/{projects}/collaborators/{id}',['uses'=>'ProjectCollaboratorsController@update',]);
but when I click update button it is generated following error
FatalErrorException in 607c064f09cf795b94deb14e18a3a34650c521d0.php line 23: syntax error, unexpected 'status' (T_STRING)
how can I fix this problem?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire