SendingMethodTableSeeder   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
dl 0
loc 24
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 22 1
1
<?php
2
3
use Illuminate\Database\Seeder;
4
use Illuminate\Database\Eloquent\Model;
5
use Hideyo\Ecommerce\Framework\Services\Shop\Entity\Shop as Shop;
6
use Hideyo\Ecommerce\Framework\Services\SendingMethod\Entity\SendingMethod as SendingMethod;
7
use Hideyo\Ecommerce\Framework\Services\TaxRate\Entity\TaxRate as TaxRate;
8
9
class SendingMethodTableSeeder extends Seeder
10
{
11
    public function run()
12
    {
13
        $taxRate = TaxRate::where('title', '=', '21%')->first();
14
        $sendingMethod = new SendingMethod;
15
16
        DB::table($sendingMethod->getTable())->delete();
17
        $shop = Shop::where('title', '=', 'hideyo')->first();
18
19
        $sendingMethod->active = 1;
20
        $sendingMethod->title = 'China';
21
        $sendingMethod->tax_rate_id = $taxRate->id; 
22
        $sendingMethod->price = '10';  
23
        $sendingMethod->shop_id = $shop->id;
24
        $sendingMethod->save();
25
26
        $sendingMethod2 = new SendingMethod;
27
       	$sendingMethod2->active = 1;
28
        $sendingMethod2->title = 'Netherlands';
29
        $sendingMethod2->tax_rate_id = $taxRate->id; 
30
        $sendingMethod2->price = '30'; 
31
        $sendingMethod2->shop_id = $shop->id;
32
        $sendingMethod2->save();
33
    }
34
}
35