| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- use App\OwnerAreaReport;
- use App\OwnerStoragePriceModel;
- use Illuminate\Database\Seeder;
- class OwnerAreaReportTableSeeder extends Seeder
- {
- /**
- * Run the database seeds.
- *
- * @return void
- * @throws Exception
- */
- public function run()
- {
- OwnerAreaReport::query()->truncate();
- // OwnerStoragePriceModel::query()->truncate();
- $owners = \App\Owner::query()->get();
- foreach ($owners as $owner) {
- $priceModels = factory(OwnerStoragePriceModel::class)->times(2)->create();
- foreach ($priceModels as $priceModel) {
- factory(OwnerAreaReport::class)->create([
- 'user_owner_group_id' => random_int(1, 100),
- 'owner_id' => $owner->id,
- 'counting_month' => now()->subMonth()->startOfMonth()->toDateString(),
- 'owner_storage_price_model_id' => $priceModel->id
- ]);
- }
- }
- }
- }
|