Файловый менеджер - Редактировать - /home/clickysoft/public_html/travel-guru.clickysoft.net/database/seeders/CountrySeeder.php
Назад
<?php namespace Database\Seeders; use Illuminate\Database\Seeder; use App\Models\Country; use App\Models\Destination; use Illuminate\Support\Str; class CountrySeeder extends Seeder { public function run() { $baseUrl = env('APP_URL') . '/destination'; $countries = [ [ 'name' => 'USA', 'slug' => 'usa', 'short_description' => 'The United States of America, a land of opportunities.', 'long_description' => 'The USA offers a wide range of experiences, from bustling cities to serene national parks.', 'meta_description' => 'USA travel guide.', 'meta_keywords' => 'USA, America, travel, destinations', 'meta_abstract' => 'USA travel guide.', 'status' => 1, 'seo' => json_encode(['key' => 'value']), 'slider_image' => 'banner-slider.png', ], [ 'name' => 'Canada', 'slug' => 'canada', 'short_description' => 'Explore the great outdoors in Canada.', 'long_description' => 'Canada is known for its natural beauty, friendly people, and diverse cities.', 'meta_description' => 'Canada travel guide.', 'meta_keywords' => 'Canada, travel, destinations', 'meta_abstract' => 'Canada travel guide.', 'status' => 1, 'seo' => json_encode(['key' => 'value']), 'slider_image' => 'banner-slider.png', ], [ 'name' => 'Mexico', 'slug' => 'mexico', 'short_description' => 'Explore the vibrant culture and history of Mexico.', 'long_description' => 'Mexico is known for its rich cultural heritage, delicious cuisine, and stunning landscapes.', 'meta_description' => 'Mexico travel guide.', 'meta_keywords' => 'Mexico, travel, destinations', 'meta_abstract' => 'Mexico travel guide.', 'status' => 1, 'seo' => json_encode(['key' => 'value']), 'slider_image' => 'banner-slider.png', ], [ 'name' => 'Brazil', 'slug' => 'brazil', 'short_description' => 'Experience the vibrant culture of Brazil, home to the Amazon rainforest and iconic Rio de Janeiro.', 'long_description' => 'Brazil is known for its diverse ecosystems, vibrant cities, and cultural richness.', 'meta_description' => 'Brazil travel guide.', 'meta_keywords' => 'Brazil, South America, travel, destinations', 'meta_abstract' => 'Brazil travel guide.', 'status' => 1, 'seo' => json_encode(['key' => 'value']), 'slider_image' => 'banner-slider.png', ], [ 'name' => 'Argentina', 'slug' => 'argentina', 'short_description' => 'Discover Argentina’s diverse attractions, from the breathtaking Patagonia to vibrant Buenos Aires.', 'long_description' => 'Argentina is known for its natural beauty, including the Andes, Patagonia, and its rich cultural heritage.', 'meta_description' => 'Argentina travel guide.', 'meta_keywords' => 'Argentina, South America, travel, destinations', 'meta_abstract' => 'Argentina travel guide.', 'status' => 1, 'seo' => json_encode(['key' => 'value']), 'slider_image' => 'banner-slider.png', ], [ 'name' => 'France', 'slug' => 'france', 'short_description' => 'Explore the cultural riches of France, from the Eiffel Tower in Paris to the vineyards of Bordeaux.', 'long_description' => 'France is famous for its rich history, cuisine, art, and landmarks.', 'meta_description' => 'France travel guide.', 'meta_keywords' => 'France, Europe, travel, destinations', 'meta_abstract' => 'France travel guide.', 'status' => 1, 'seo' => json_encode(['key' => 'value']), 'slider_image' => 'banner-slider.png', ], [ 'name' => 'Japan', 'slug' => 'japan', 'short_description' => 'Experience the unique blend of tradition and modernity in Japan, from Tokyo’s skyscrapers to Kyoto’s temples.', 'long_description' => 'Japan offers a mix of ancient traditions and cutting-edge modernity.', 'meta_description' => 'Japan travel guide.', 'meta_keywords' => 'Japan, Asia, travel, destinations', 'meta_abstract' => 'Japan travel guide.', 'status' => 1, 'seo' => json_encode(['key' => 'value']), 'slider_image' => 'banner-slider.png', ], [ 'name' => 'South Africa', 'slug' => 'south-africa', 'short_description' => 'Discover South Africa’s rich history, diverse cultures, and stunning landscapes, including Table Mountain and Kruger National Park.', 'long_description' => 'South Africa is known for its wildlife, natural beauty, and cultural diversity.', 'meta_description' => 'South Africa travel guide.', 'meta_keywords' => 'South Africa, Africa, travel, destinations', 'meta_abstract' => 'South Africa travel guide.', 'status' => 1, 'seo' => json_encode(['key' => 'value']), 'slider_image' => 'banner-slider.png', ], [ 'name' => 'Australia', 'slug' => 'australia', 'short_description' => 'Explore Australia’s unique landscapes, from the Great Barrier Reef to the Outback.', 'long_description' => 'Australia is known for its natural wonders and vibrant cities.', 'meta_description' => 'Australia travel guide.', 'meta_keywords' => 'Australia, Oceania, travel, destinations', 'meta_abstract' => 'Australia travel guide.', 'status' => 1, 'seo' => json_encode(['key' => 'value']), 'slider_image' => 'banner-slider.png', ], [ 'name' => 'Italy', 'slug' => 'italy', 'short_description' => 'Immerse yourself in Italy’s rich history and culture, from the Roman Colosseum to the canals of Venice.', 'long_description' => 'Italy is known for its historical sites, art, cuisine, and picturesque landscapes.', 'meta_description' => 'Italy travel guide.', 'meta_keywords' => 'Italy, Europe, travel, destinations', 'meta_abstract' => 'Italy travel guide.', 'status' => 1, 'seo' => json_encode(['key' => 'value']), 'slider_image' => 'banner-slider.png', ], [ 'name' => 'New Zealand', 'slug' => 'new-zealand', 'short_description' => 'Discover the natural beauty of New Zealand, from the fjords of Milford Sound to the geothermal wonders of Rotorua.', 'long_description' => 'New Zealand is famous for its stunning landscapes, adventure tourism, and Maori culture.', 'meta_description' => 'New Zealand travel guide.', 'meta_keywords' => 'New Zealand, Oceania, travel, destinations', 'meta_abstract' => 'New Zealand travel guide.', 'status' => 1, 'seo' => json_encode(['key' => 'value']), 'slider_image' => 'banner-slider.png', ], // Add more countries as needed ]; // Fetch all destinations $destinations = Destination::all(); foreach ($countries as $countryData) { // Create the country $country = Country::create([ 'name' => $countryData['name'], 'slug' => $countryData['slug'], 'short_description' => $countryData['short_description'], 'long_description' => $countryData['long_description'], 'meta_description' => $countryData['meta_description'], 'meta_keywords' => $countryData['meta_keywords'], 'meta_abstract' => $countryData['meta_abstract'], 'status' => $countryData['status'], 'seo' => $countryData['seo'], ]); // Attach the country to a random destination $randomDestinations = $destinations->random(2); foreach ($randomDestinations as $destination) { $country->destinations()->attach($destination->id); } // Process the slider images for ($i = 0; $i < 5; $i++) { $sliderImageUrl = "{$baseUrl}/{$countryData['slider_image']}"; $country->addMediaFromUrl($sliderImageUrl) ->toMediaCollection('sliders'); } } } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка