App\Repositories\Eloquent\RoleRepositoryEloquent::update PHP Method

update() public method

public update ( array $input, $id ) : boolean
$input array
$id
return boolean
    public function update(array $input, $id)
    {
        $role = Role::find($id);
        if (count($input['assignees_permissions']) == 0) {
            throw new GeneralException('You must select at least one permission for this role.');
        }
        $role->name = $input['name'];
        $role->display_name = $input['display_name'];
        $role->description = $input['description'];
        if ($role->save()) {
            $role->savePermissions($input['assignees_permissions']);
            return true;
        }
        throw new GeneralException('There was a problem updating this role. Please try again.');
    }
RoleRepositoryEloquent