Code Duplication    Length = 11-14 lines in 2 locations

src/z1haze/Acl/Traits/UserAndLevel.php 2 locations

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