OptionMigration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 11
c 1
b 0
f 1
dl 0
loc 19
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 14 2
1
<?php
2
3
namespace App\Console\Commands\Migrations;
4
5
use App\Entities\Option;
6
use Illuminate\Console\Command;
7
8
class OptionMigration extends Migration
9
{
10
    /**
11
     * @param Command $command
12
     */
13
    public function handle($command)
14
    {
15
        $command->info('Migrating Options...');
16
        $options = $this->table('options')->get();
17
        foreach ($options as $option) {
18
            $newOption = new Option();
19
            $newOption->key = $option->name;
20
            $newOption->description = $option->desc;
21
            $newOption->value = $option->value;
22
            $newOption->category = 'default';
23
            $newOption->save();
24
        }
25
26
        $command->info('Migrating Options Done');
27
    }
28
}
29