Completed
Push — master ( eb8262...25c565 )
by Ryan
01:49
created

RoleSeeder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 48
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B run() 0 24 1
1
<?php namespace Anomaly\UsersModule\Seeder;
2
3
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
4
use Anomaly\UsersModule\Role\Contract\RoleRepositoryInterface;
5
6
/**
7
 * Class RoleSeeder
8
 *
9
 * @link          http://pyrocms.com/
10
 * @author        PyroCMS, Inc. <[email protected]>
11
 * @author        Ryan Thompson <[email protected]>
12
 * @package       Anomaly\UsersModule\Seeder
13
 */
14
class RoleSeeder extends Seeder
15
{
16
17
    /**
18
     * The role repository.
19
     *
20
     * @var RoleRepositoryInterface
21
     */
22
    protected $roles;
23
24
    /**
25
     * Create a new RoleSeeder instance.
26
     *
27
     * @param RoleRepositoryInterface $roles
28
     */
29
    public function __construct(RoleRepositoryInterface $roles)
30
    {
31
        $this->roles = $roles;
32
    }
33
34
    /**
35
     * Run the seeder.
36
     */
37
    public function run()
38
    {
39
        $this->roles->truncate();
40
41
        $this->roles->create(
42
            [
43
                'en'   => [
44
                    'name'        => 'Admin',
45
                    'description' => 'The super admin role.'
46
                ],
47
                'slug' => 'admin'
48
            ]
49
        );
50
51
        $this->roles->create(
52
            [
53
                'en'   => [
54
                    'name'        => 'User',
55
                    'description' => 'The default user role.'
56
                ],
57
                'slug' => 'user'
58
            ]
59
        );
60
    }
61
}
62