Passed
Push — master ( 92224a...b0c10d )
by nguereza
03:55 queued 01:47
created

ProductsSeed::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 28
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 21
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 28
rs 9.584
1
<?php
2
declare(strict_types=1);
3
4
namespace Platine\Framework\Migration\Seed;
5
6
use Platine\Framework\Migration\Seed\AbstractSeed;
7
8
class ProductsSeed extends AbstractSeed
9
{
10
11
    public function run(): void
12
    {
13
      //Action when run the seed
14
      
15
        $data = [
16
    0 => [
17
        'id' => 1,
18
        'name' => 'Toyota Corolla Verso 1.8',
19
        'description' => NULL,
20
        'price' => 3467.0,
21
        'quantity' => 2.0,
22
        'product_category_id' => 2,
23
        'created_at' => '2023-12-07 06:21:59',
24
        'updated_at' => NULL,
25
    ],
26
    1 => [
27
        'id' => 2,
28
        'name' => 'HP 840',
29
        'description' => NULL,
30
        'price' => 890.0,
31
        'quantity' => 14.0,
32
        'product_category_id' => 1,
33
        'created_at' => '2023-12-07 06:26:46',
34
        'updated_at' => '2023-12-07 14:18:29',
35
    ],
36
];
37
        foreach ($data as $row) {
38
            $this->insert($row)->into('products');
39
        }
40
        
41
    }
42
}