OrderPackageFactory.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /** @var \Illuminate\Database\Eloquent\Factory $factory */
  3. use App\Order;
  4. use App\OrderPackage;
  5. use Faker\Generator as Faker;
  6. $factory->define(OrderPackage::class, function (Faker $faker) {
  7. $statuses = ['无', '已称重', '已揽收', '在途', '在途异常', '派送中', '派送异常', '返回中', '返回异常', '返回派件', '其他异常', '已收件',];
  8. $exceptions = ['是', '否'];
  9. $exception_types = ['疑似库内丢件','揽件异常','中转异常','疑似丢件','派件异常','其他','无'];
  10. return [
  11. 'logistic_number' => $faker->uuid,
  12. 'order_id' => random_int(1, 10000),
  13. 'batch_number' => random_int(1, 100),
  14. 'batch_rule' => null,
  15. 'bulk' => null,
  16. 'weight' => null,
  17. 'height' => null,
  18. 'paper_box_id' => random_int(1, 100),
  19. 'measuring_machine_id' => random_int(1, 100),
  20. 'weighed_at' => now()->subHours(3),
  21. 'status' => $faker->randomElement($statuses),
  22. 'sent_at' => now()->subHours(1),
  23. 'received_at' => null,
  24. 'exception' => $faker->randomElement($exceptions),
  25. 'transfer_status' => null,
  26. 'remark' => null,
  27. 'owner_id' => random_int(1, 100),
  28. 'uploaded_to_wms' => '是',
  29. 'exception_message' => $faker->name,
  30. 'exception_type' => $faker->randomElement($exception_types),
  31. ];
  32. });