SeedCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 35
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 10 2
1
<?php
2
3
namespace Enomotodev\LaractiveAdmin\Console;
4
5
use Illuminate\Console\Command;
6
use Enomotodev\LaractiveAdmin\AdminUser;
7
8
class SeedCommand extends Command
9
{
10
    /**
11
     * @var string
12
     */
13
    const ADMIN_USER_EMAIL = '[email protected]';
14
15
    /**
16
     * @var string
17
     */
18
    const ADMIN_USER_PASSWORD = 'password';
19
20
    /**
21
     * @var string
22
     */
23
    protected $name = 'laractive-admin:seed';
24
25
    /**
26
     * @var string
27
     */
28
    protected $description = 'Generate seed data';
29
30
    /**
31
     * @return void
32
     */
33 1
    public function handle()
34
    {
35 1
        if (! AdminUser::where('email', '[email protected]')->first()) {
36 1
            AdminUser::create([
37 1
                'email' => self::ADMIN_USER_EMAIL,
38 1
                'password' => \Hash::make(self::ADMIN_USER_PASSWORD),
39
            ]);
40
        }
41
42 1
        $this->info('Generate data successfully!');
43 1
    }
44
}
45