SendingMethodTableSeeder::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 17
nc 1
nop 0
dl 0
loc 22
rs 9.7
c 1
b 0
f 0
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