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

AuthorizationSuperAdminsSeeder_9::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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