InstallCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 3 1
A initDatabase() 0 4 1
1
<?php
2
3
namespace TopviewDigital\LangSwitcher\Console;
4
5
use Illuminate\Console\Command;
6
use TopviewDigital\LangSwitcher\Model\LangSwitcher;
7
8
class InstallCommand extends Command
9
{
10
    /**
11
     * The console command name.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'lang-switch:install';
16
    /**
17
     * The console command description.
18
     *
19
     * @var string
20
     */
21
    protected $description = 'Install the language switcher tables accoding to config';
22
    /**
23
     * Install directory.
24
     *
25
     * @var string
26
     */
27
    protected $directory = '';
28
29
    /**
30
     * Execute the console command.
31
     *
32
     * @return void
33
     */
34
    public function handle()
35
    {
36
        $this->initDatabase();
37
    }
38
39
    /**
40
     * Create tables and seed it.
41
     *
42
     * @return void
43
     */
44
    public function initDatabase()
45
    {
46
        $this->call('migrate');
47
        LangSwitcher::firstOrCreate(['class' => 'Auth', 'method' => 'user', 'middleware' => 'web']);
48
    }
49
}
50