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, ]); } } }