PermissionsSeeder::seed()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 0
cts 8
cp 0
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
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