Files
DredgeTours/database/seeders/TourCountrySeeder.php
2025-09-16 22:01:42 +10:00

28 lines
828 B
PHP

<?php
namespace Database\Seeders;
use App\Models\Country;
use App\Models\Tour;
use App\Models\TourCountry;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class TourCountrySeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$tourMap = Tour::all()->pluck('id', 'internal_name')->toArray();
$countryMap= Country::all()->pluck('id', 'internal_name')->toArray();
\DB::table('tour_countries')->insert([
['tour_id' => $tourMap['cantonese_charm'], 'country_id' => $countryMap['china']],
['tour_id' => $tourMap['fujianese_fantasy'], 'country_id' => $countryMap['china']],
['tour_id' => $tourMap['hebei_harmony'], 'country_id' => $countryMap['china']],
]);
}
}