Passed
Pull Request — master (#1121)
by Iman
03:51
created

Seeder::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 14
nc 2
nop 0
dl 0
loc 19
c 0
b 0
f 0
cc 2
rs 9.4285
1
<?php
2
3
namespace crocodicstudio\crudbooster\Modules\PrivilegeModule;
4
5
use crocodicstudio\crudbooster\CBCoreModule\CbUsersRepo;
6
use Illuminate\Support\Facades\DB;
7
8
class Seeder
9
{
10
    public static function run()
11
    {
12
        $exists = DB::table('cms_privileges')->where('name', 'Super Administrator')->exists();
13
        if ($exists) {
14
            return;
15
        }
16
        unset($exists);
17
        $pid = DB::table('cms_privileges')->insertGetId([
18
            'name' => 'Super Administrator',
19
            'is_superadmin' => 1,
20
            'theme_color' => 'skin-red',
21
        ]);
22
23
        CbUsersRepo::table()->insert([
24
            'name' => 'Super Admin',
25
            'email' => '[email protected]',
26
            'password' => \Hash::make('123456'),
27
            'id_cms_privileges' => $pid,
28
            'status' => 'Active',
29
        ]);
30
    }
31
}