OwnerOutStorageRuleFactory.php 989 B

1234567891011121314151617181920
  1. <?php
  2. /** @var \Illuminate\Database\Eloquent\Factory $factory */
  3. use App\OwnerOutStorageRule;
  4. use Faker\Generator as Faker;
  5. $unit = \App\Unit::query()->first();
  6. $factory->define(OwnerOutStorageRule::class, function (Faker $faker)use(&$unit) {
  7. if (!$unit)$unit = \App\Unit::query()->first();
  8. $strategy = ['默认','特征'];
  9. return [
  10. "owner_price_operation_id" => factory(\App\OwnerPriceOperation::class), //作业计费ID
  11. "strategy" =>$strategy[array_rand($strategy)], //策略
  12. "amount" =>mt_rand(0,100), //起步数
  13. "unit_id" => $unit ? $unit->id : factory(\App\Unit::class),//单位ID
  14. "unit_price" =>mt_rand(10,100) / 12, //单价
  15. "feature" =>\Illuminate\Support\Str::random(6), //特征
  16. ];
  17. });