如何使用Laravel 5.2中的if else条件更新表值

时间:2016-11-26 08:30:24

标签: php mysql laravel-5

我在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');
}

当我更改权限值时,如何使用if else条件在此处编写更新代码?

0 个答案:

没有答案