| 12345678910111213141516171819202122 |
- <?php
- /** @var \Illuminate\Database\Eloquent\Factory $factory */
- use App\OwnerStoragePriceModel;
- use Faker\Generator as Faker;
- $unit = \App\Unit::query()->first();
- $factory->define(OwnerStoragePriceModel::class, function (Faker $faker) use(&$unit){
- if (!$unit) $unit = \App\Unit::query()->first();
- $counting_type = ['包仓','灵活用仓','统单价'];
- $using_type = ['常温','恒温'];
- $discount_type = ['无减免','按单减免','固定减免'];
- return [
- "counting_type" => array_rand($counting_type), //计费类型
- "using_type" => array_rand($using_type), //用仓类型
- "minimum_area" => mt_rand(100,1000) / 50, //最低起租面积
- "price" => mt_rand(1,20) / 10, //单价
- "discount_type" => array_rand($discount_type), //减免类型
- "discount_value" => mt_rand(0,10) / 12, //减免值
- "unit_id" => $unit ? $unit->id : factory(\App\Unit::class), //单位ID
- ];
- });
|