Passed
Push — develop ( 9324e6...f3eb57 )
by Septianata
04:31
created

ItemFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A definition() 0 7 1
1
<?php
2
3
namespace Database\Factories;
4
5
use App\Models\Item;
6
use Illuminate\Database\Eloquent\Factories\Factory;
7
use Tests\Feature\Admin\DenominationTest;
8
9
class ItemFactory extends Factory
10
{
11
    /**
12
     * The name of the factory's corresponding model.
13
     *
14
     * @var string
15
     */
16
    protected $model = Item::class;
17
18
    /**
19
     * Define the model's default state.
20
     *
21
     * @return array
22
     */
23
    public function definition()
24
    {
25
        $denomination = DenominationTest::createFromFactory();
26
27
        return [
28
            'denomination_id' => $denomination,
29
            'bundle_quantity' => $denomination->range_order_bundle[array_rand($denomination->range_order_bundle)],
30
        ];
31
    }
32
}
33