@@ 428-438 (lines=11) @@ | ||
425 | * |
|
426 | * @param $permissionObjects |
|
427 | */ |
|
428 | protected function remove($permissionObjects) |
|
429 | { |
|
430 | if (is_a($this, config('laravel-acl.user'))) { |
|
431 | $this->permissions()->detach($permissionObjects); |
|
432 | } |
|
433 | ||
434 | if (is_a($this, config('laravel-acl.level'))) { |
|
435 | config('laravel-acl.permission', Permission::class)::whereIn('id', array_map(function($permission) { |
|
436 | return $permission->id; |
|
437 | }, $permissionObjects))->update(['level_id' => null]); |
|
438 | } |
|
439 | } |
|
440 | ||
441 | /** |
|
@@ 447-460 (lines=14) @@ | ||
444 | * |
|
445 | * @param $permissionObjects |
|
446 | */ |
|
447 | protected function sync($permissionObjects) |
|
448 | { |
|
449 | if (is_a($this, config('laravel-acl.user'))) { |
|
450 | $this->permissions()->sync($permissionObjects); |
|
451 | } |
|
452 | ||
453 | if (is_a($this, config('laravel-acl.level'))) { |
|
454 | $this->clearPermissions(); |
|
455 | ||
456 | config('laravel-acl.permission', Permission::class)::whereIn('id', array_map(function($permission) { |
|
457 | return $permission->id; |
|
458 | }, $permissionObjects)) |
|
459 | ->update(['level_id' => $this->id]); |
|
460 | } |
|
461 | } |
|
462 | ||
463 | /** |