| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- use App\OwnerFeeDetail;
- use App\OwnerLogisticFeeDetail;
- use Carbon\Carbon;
- use Illuminate\Database\Seeder;
- class OwnerLogisticFeeDetailSeeder extends Seeder
- {
- /**
- * Run the database seeds.
- *
- * @return void
- */
- public function run()
- {
- // $ownerFeeDetails = OwnerFeeDetail::query()
- // ->with('items')
- // ->where('type', '发货')
- // ->where('outer_table_name', 'orders')
- // ->whereHas('logistic', function ($query) {
- // $query->where('type', '快递');
- // })
- // ->where('owner_id', [12])
- // ->where('worked_at', '>=', Carbon::parse('2021-05-30')->startOfDay())
- // ->where('worked_at', '<=', Carbon::parse('2021-05-31')->endOfDay())
- // ->get();
- // foreach ($ownerFeeDetails as $ownerFeeDetail) {
- // factory(\App\OwnerLogisticFeeDetail::class)->create([
- // 'owner_fee_detail_id' => $ownerFeeDetail->id,
- // 'logistic_bill' => $ownerFeeDetail->items->first()->logistic_bill??$ownerFeeDetail->logistic_bill,
- // 'logistic_id'=>$ownerFeeDetail->logistic_id,
- // 'province'=>$ownerFeeDetail->province
- // ]);
- // }
- // factory(\App\OwnerLogisticFeeDetail::class)->times(200)->create(
- // [
- // 'created_at' =>now()->subMonth()->startOfMonth()->addDays(1),
- // 'updated_at' => now()->subMonth()->startOfMonth()->addDays(2)
- // ]
- // );
- //
- // factory(\App\OwnerLogisticFeeDetail::class)->times(200)->create(
- // [
- // 'created_at' =>now()->subMonth()->startOfMonth()->addDays(2),
- // 'updated_at' => now()->subMonth()->startOfMonth()->addDays(3)
- // ]
- // );
- //
- // factory(\App\OwnerLogisticFeeDetail::class)->times(200)->create(
- // [
- // 'created_at' =>now()->subMonth()->startOfMonth()->addDays(3),
- // 'updated_at' => now()->subMonth()->startOfMonth()->addDays(4)
- // ]
- // );
- OwnerLogisticFeeDetail::query()->truncate();
- // OwnerFeeDetail::query()->truncate();
- $owners = \App\Owner::query()->limit(10)->get();
- foreach ($owners as $owner) {
- factory(OwnerLogisticFeeDetail::class)->times(200)->create([
- 'owner_id' => $owner->id,
- ]);
- }
- }
- }
|