DefaultSeeder   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B run() 0 39 1
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
}