samedi 3 décembre 2016

Missing argument 3 for App\Http\Controllers\ProjectCollaboratorsController::update() in Laravel

I am going to update My permission values (table name also permission) this is My edit function regarding permission

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'));

}

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(permission.edit.php)

<form class="form-vertical" role="form" method="post" action="">

and routes is

Route::put('projects/{projects}/permission',['uses'=>'ProjectCollaboratorsController@update',]);

but generated following error

ErrorException in ProjectCollaboratorsController.php line 268: Missing argument 3 for App\Http\Controllers\ProjectCollaboratorsController::update()

permission model scope is

 public function scopePermissioneditt($query, $id, $projectId)
    {
        return $query->where('collaborator_id',$id)->where('project_id',$projectId);//->exists();

    }

how can I fix this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire