public function update(Permission $permission)
    {
        $this->validate($this->request, [
            'name'     => 'required',
            'resource' => 'required|alpha_num',
            'slug'     => 'required|unique:permissions,slug,' . $permission->id,
        ]);

        $permission->name     = $this->request->get('name');
        $permission->resource = $this->request->get('resource');
        if (! $permission->system) {
            $permission->slug = $this->request->get('slug');
        }
        $permission->save();

        $permission->syncRoles($this->request->get('roles', []));

        return redirect()->route('administrator.permissions.index');
    }
public function update(Permission $permission)
    {
        $this->validate($this->request, [
            'name'     => 'required',
            'resource' => 'required|alpha_num',
            'slug'     => 'required|unique:permissions,slug,' . $permission->id,
        ]);

        $permission->name     = $this->request->get('name');
        $permission->resource = $this->request->get('resource');
        if (! $permission->system) {
            $permission->slug = $this->request->get('slug');
        }
        $permission->save();

        $permission->syncRoles($this->request->get('roles', []));

        return redirect()->route('administrator.permissions.index');
    }
public function update ( Permission $ permission ) { $ this -> validate ( $ this -> request , [ 'name' => 'required' , 'resource' => 'required|alpha_num' , 'slug' => 'required|unique:permissions,slug,' . $ permission -> id , ] ) ; $ permission -> name = $ this -> request -> get ( 'name' ) ; $ permission -> resource = $ this -> request -> get ( 'resource' ) ; if ( ! $ permission -> system ) { $ permission -> slug = $ this -> request -> get ( 'slug' ) ; } $ permission -> save ( ) ; $ permission -> syncRoles ( $ this -> request -> get ( 'roles' , [ ] ) ) ; return redirect ( ) -> route ( 'administrator.permissions.index' ) ; }
Update selected permission.

@param \Yajra\Acl\Models\Permission $permission
@return \Illuminate\Http\RedirectResponse
Update selected permission .