28 lines
827 B
PHP
28 lines
827 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_hijinx'], 'country_id' => $countryMap['china']],
|
|
]);
|
|
|
|
}
|
|
}
|