| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- use App\Commodity;
- use App\Owner;
- use App\OwnerFeeDetail;
- use App\OwnerPriceOperation;
- use App\OwnerPriceOperationItem;
- use App\OwnerStoreOutFeeDetail;
- use Illuminate\Database\Seeder;
- class OwnerStoreOutFeeDetailSeeder extends Seeder
- {
- /**
- * Run the database seeds.
- *
- * @return void
- */
- public function run()
- {
- OwnerStoreOutFeeDetail::query()->truncate();
- $owners = Owner::query()->limit(10)->get();
- foreach ($owners as $owner) {
- $commoditys = factory(Commodity::class)->times(10)->create();
- $feeDetails = factory(OwnerFeeDetail::class)->times(3)->create([
- 'type' => '发货',
- 'owner_id' => $owner->id,
- ]);
- foreach ($feeDetails as $feeDetail) {
- foreach ($commoditys as $commodity) {
- factory(OwnerStoreOutFeeDetail::class)->times(5)->create([
- 'owner_id' => $owner->id,
- 'owner_fee_detail_id' => $feeDetail->id,
- 'commodity_id' => $commodity->id,
- ]);
- }
- }
- }
- }
- }
|