Featured tours working
This commit is contained in:
27
database/seeders/TourCountrySeeder.php
Normal file
27
database/seeders/TourCountrySeeder.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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']],
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user