DefaultSeeder::run()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 39
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 39
rs 8.8571
cc 1
eloc 22
nc 1
nop 0
1
<?php
2
3
class DefaultSeeder extends DatabaseSeeder
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
6
    public function run()
7
    {
8
        
9
        $admin = Sentinel::registerAndActivate(array(
10
            'email'       => '[email protected]',
11
            'password'    => 'admin',
12
            'first_name'  => 'John',
13
            'last_name'   => 'Doe',
14
            'status'      => 1,
15
        ));
16
17
        $adminRole = Sentinel::getRoleRepository()->createModel()->create([
18
            'name' => 'Admin',
19
            'slug' => 'admin',
20
            'permissions' => array('admin' => 1),
21
        ]);
22
23
        Base::getSettingsRepository()->createModel()->create([
24
            'friendly_name'  => 'SITE_NAME',
25
            'name'  => 'Website name',
26
            'value'  => 'John Doe\'s website',
27
            'description'  => 'Website name',
28
        ]);
29
30
        Base::getSettingsRepository()->createModel()->create([
31
            'friendly_name'  => 'USER_REGISTRATION',
32
            'name'  => 'User registration status',
33
            'value'  => '1',
34
            'description'  => '/*
35
                                * 0 - Disabled
36
                                * 1 - Enabled and no activation
37
                                * 2 - User activation
38
                                * 3 - Admin activation
39
                                */',
40
        ]);
41
42
        $admin->roles()->attach($adminRole);
43
44
    }
45
46
}