Completed
Push — master ( 11ad20...a09f6d )
by Sergi Tur
05:23
created

AdminLTEAdmin::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace Acacha\AdminLTETemplateLaravel\Console;
4
5
use Illuminate\Console\Command;
6
7
/**
8
 * Class AdminLTEAdmin.
9
 */
10
class AdminLTEAdmin extends Command
11
{
12
    use HasUsername, HasEmail;
13
14
    /**
15
     * The name and signature of the console command.
16
     */
17
    protected $signature = 'adminlte-laravel:admin';
18
19
    /**
20
     * The console command description.
21
     *
22
     * @var string
23
     */
24
    protected $description = 'Create a seed for admin user and execute seed';
25
26
    /**
27
     * Execute the console command.
28
     */
29
    public function handle()
30
    {
31
        $this->call('make:adminUserSeeder');
32
        $this->call('db:seed',[
33
            '--class' => basename(config('AdminUserSeeder','AdminUserSeeder.php'), ".php")
34
        ]);
35
        $this->info('User ' . $this->username() . '(' . $this->email() . ') ' .
36
            $this->passwordInfo() . ' created succesfully!');
37
    }
38
39
    /**
40
     * Get password info.
41
     */
42
    protected function passwordInfo()
43
    {
44
        if (env('ADMIN_PWD', '123456') == '123456') return 'with password 123456';
45
        return 'with the environemnt password (env var ADMIN_PWD)';
46
    }
47
}
48