samedi 26 novembre 2016

how to update table values using if else condition in Laravel 5.2

I am adding permission values using this function in My Controller.

public function addPermission(Request $request, $id,  Permission $permission)
    {
         $this->validate($request, [
            'status'   => 'required'


        ]);

        $permission = new Permission;

        $permission->status = $request->input('status');
        $permission->project_id       = $id;
        $permission->collaborator_id =  $request->input('cid');
        $permission->save();
        return redirect()->back()->with('info','Permission has been added to your Collaborator successfully');
}

how can I write update code here using if else condition when I change permission value?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire