OptionMigration::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 10
c 1
b 0
f 1
nc 2
nop 1
dl 0
loc 14
rs 9.9332
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