<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */

use App\OwnerInStorageRule;
use Faker\Generator as Faker;

$unit = \App\Unit::query()->first();
$factory->define(OwnerInStorageRule::class, function (Faker $faker)use(&$unit){
    if (!$unit)$unit = \App\Unit::query()->first();
    return [
        "owner_price_operation_id"  => factory(\App\OwnerPriceOperation::class), //作业计费ID
        "amount"                    => mt_rand(0,100),                   //计量
        "unit_id"                   => $unit ? $unit->id : factory(\App\Unit::class),//单位ID
        "unit_price"                =>mt_rand(10,100) / 16,               //单价
    ];
});
