Файловый менеджер - Редактировать - /home/clickysoft/public_html/travel-guru.clickysoft.net/database/seeders/CategorySeeder.php
Назад
<?php namespace Database\Seeders; use Illuminate\Database\Seeder; use App\Models\Category; use Illuminate\Support\Facades\Http; class CategorySeeder extends Seeder { public function run() { $baseUrl = env('APP_URL') . '/category'; $categories = [ [ 'title' => 'Cruises', 'slug' => 'cruises', 'image' => 'ad1.png', 'slider_image' => 'cruise.png', ], [ 'title' => 'Safaris', 'slug' => 'safaris', 'image' => 'ad2.png', 'slider_image' => 'safari.png', ], [ 'title' => 'Polar Regions', 'slug' => 'polar-regions', 'image' => 'ad3.png', 'slider_image' => 'polar-region.png', ], [ 'title' => 'Special Occasions', 'slug' => 'special-occasions', 'image' => 'ad4.png', 'slider_image' => 'special-occasion.png', ], ]; foreach ($categories as $categoryData) { $category = Category::create([ 'title' => $categoryData['title'], 'slug' => $categoryData['slug'], 'status' => true, 'short_description' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.', ]); // Add the featured image from URL $category->addMediaFromUrl("{$baseUrl}/{$categoryData['image']}") ->toMediaCollection('featured_image'); // Process the slider images for ($i = 0; $i < 5; $i++) { $sliderImageUrl = "{$baseUrl}/{$categoryData['slider_image']}"; // Add the slider image from URL $category->addMediaFromUrl($sliderImageUrl) ->toMediaCollection('sliders'); } } } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка