Completed
Pull Request — master (#1163)
by
unknown
06:21
created

MigrateFileToDatabaseCommand::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
namespace Nwidart\Modules\Commands;
4
5
use Illuminate\Console\Command;
6
7
class MigrateFileToDatabaseCommand extends Command
8
{
9
    /**
10
     * The console command name.
11
     *
12
     * @var string
13
     */
14
    protected $name = 'module:migrate-to-database';
15
16
    /**
17
     * The console command description.
18
     *
19
     * @var string
20
     */
21
    protected $description = 'Migrate all modules to database management.';
22
23
    /**
24
     * Execute the console command.
25
     */
26
    public function handle(): int
27
    {
28
        if (!config('modules.database_management.enabled')) {
29
            $this->info('This feature only works when database management is on.');
30
31
            return false;
32
        }
33
        $this->laravel['modules']->migrateFileToDatabase();
34
        $this->info('Migrated.');
35
36
        return 0;
37
    }
38
39
    /**
40
     * Get the console command options.
41
     *
42
     * @return array
43
     */
44
    protected function getOptions()
45
    {
46
        return [];
47
    }
48
}
49