OwnerPriceExpressFactory.php 579 B

12345678910111213141516
  1. <?php
  2. /** @var \Illuminate\Database\Eloquent\Factory $factory */
  3. use App\OwnerPriceExpress;
  4. use Faker\Generator as Faker;
  5. $unit = \App\Unit::query()->first();
  6. $factory->define(OwnerPriceExpress::class, function (Faker $faker)use(&$unit) {
  7. if (!$unit)$unit = \App\Unit::query()->first();
  8. return [
  9. "name" => $faker->name, //名称
  10. "initial_weight_unit_id" => $unit ? $unit->id : factory(\App\Unit::class), //首重单位
  11. "additional_weight_unit_id" => $unit ? $unit->id : factory(\App\Unit::class),//续重单位
  12. ];
  13. });