PermissionsSeeder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 4
dl 0
loc 25
ccs 0
cts 8
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A seed() 0 12 2
1
<?php namespace Arcanesoft\Auth\Seeds;
2
3
use Arcanedev\Support\Database\Seeder;
4
use Arcanesoft\Auth\Models\Permission;
5
use Arcanesoft\Auth\Models\PermissionsGroup;
6
7
/**
8
 * Class     PermissionsSeeder
9
 *
10
 * @package  Arcanesoft\Auth\Seeds
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
abstract class PermissionsSeeder extends Seeder
14
{
15
    /* -----------------------------------------------------------------
16
     |  Main Methods
17
     | -----------------------------------------------------------------
18
     */
19
20
    /**
21
     * Seed permissions.
22
     *
23
     * @param  array  $seeds
24
     */
25
    public function seed(array $seeds)
26
    {
27
        foreach ($seeds as $seed) {
28
            /** @var  \Arcanesoft\Auth\Models\PermissionsGroup  $group */
29
            $group       = PermissionsGroup::create($seed['group']);
0 ignored issues
show
Bug introduced by
The method create() does not exist on Arcanesoft\Auth\Models\PermissionsGroup. Did you maybe mean created()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
30
            $permissions = array_map(function ($permission) {
31
                return new Permission($permission);
32
            }, $seed['permissions']);
33
34
            $group->permissions()->saveMany($permissions);
35
        }
36
    }
37
}
38