@@ 442-452 (lines=11) @@ | ||
439 | * |
|
440 | * @param $permissionObjects |
|
441 | */ |
|
442 | protected function remove($permissionObjects) |
|
443 | { |
|
444 | if (is_a($this, config('laravel-acl.user'))) { |
|
445 | $this->permissions()->detach($permissionObjects); |
|
446 | } |
|
447 | ||
448 | if (is_a($this, config('laravel-acl.level'))) { |
|
449 | config('laravel-acl.permission', Permission::class)::whereIn('id', array_map(function($permission) { |
|
450 | return $permission->id; |
|
451 | }, $permissionObjects))->update(['level_id' => null]); |
|
452 | } |
|
453 | } |
|
454 | ||
455 | /** |
|
@@ 461-474 (lines=14) @@ | ||
458 | * |
|
459 | * @param $permissionObjects |
|
460 | */ |
|
461 | protected function sync($permissionObjects) |
|
462 | { |
|
463 | if (is_a($this, config('laravel-acl.user'))) { |
|
464 | $this->permissions()->sync($permissionObjects); |
|
465 | } |
|
466 | ||
467 | if (is_a($this, config('laravel-acl.level'))) { |
|
468 | $this->clearPermissions(); |
|
469 | ||
470 | config('laravel-acl.permission', Permission::class)::whereIn('id', array_map(function($permission) { |
|
471 | return $permission->id; |
|
472 | }, $permissionObjects)) |
|
473 | ->update(['level_id' => $this->id]); |
|
474 | } |
|
475 | } |
|
476 | ||
477 | /** |