Completed
Push — master ( fcadec...5798cc )
by Mahmoud
03:32
created

AuthorizationSuperAdminsSeeder_9   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A run() 0 14 1
1
<?php
2
3
namespace App\Containers\Authorization\Data\Seeders;
4
5
use App\Containers\Authorization\Tasks\GetRoleTask;
6
use App\Containers\User\Models\User;
7
use App\Port\Seeder\Abstracts\Seeder;
8
use Illuminate\Support\Facades\Hash;
9
10
/**
11
 * Class AuthorizationSuperAdminsSeeder_9
12
 *
13
 * @author  Mahmoud Zalt  <[email protected]>
14
 */
15
class AuthorizationSuperAdminsSeeder_9 extends Seeder
16
{
17
18
    /**
19
     * @var  \App\Containers\Authorization\Tasks\GetRoleTask
20
     */
21
    private $getRoleTask;
22
23
    /**
24
     * SuperAdminSeeder constructor.
25
     *
26
     * @param \App\Containers\Authorization\Tasks\GetRoleTask $getRoleTask
27
     */
28
    public function __construct(GetRoleTask $getRoleTask)
29
    {
30
        $this->getRoleTask = $getRoleTask;
31
    }
32
33
    /**
34
     * Run the database seeds.
35
     *
36
     * @return void
37
     */
38
    public function run()
39
    {
40
        // Default Users ----------------------------------------------------------------
41
42
        $admin = new User();
43
        $admin->name = 'Super Admin';
44
        $admin->email = '[email protected]';
45
        $admin->password = Hash::make('admin');
46
        $admin->save();
47
        $admin->assignRole($this->getRoleTask->run('admin'));
48
49
        // ...
50
51
    }
52
}
53