| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace Database\Seeders;
- /*
- * CarsFromDromSeeder — 30 автомобилей с реальными данными с auto.drom.ru
- * Данные вынесены в database/seeders/data/cars_drom.php (файл возвращает массив).
- * steering: Москва → left; японские авто из Владивостока → right.
- */
- use App\Models\Car;
- use Illuminate\Database\Seeder;
- class CarsFromDromSeeder extends Seeder
- {
- public function run(): void
- {
- $cars = require __DIR__ . '/data/cars_drom.php';
- foreach ($cars as $data) {
- Car::create(array_merge($data, [
- 'status' => 'active',
- 'doors' => null,
- 'vin' => null,
- 'plate' => null,
- 'color_exterior' => null,
- 'color_interior' => null,
- 'generation' => null,
- 'owners_count' => null,
- 'customs_cleared' => false,
- 'accident_free' => false,
- 'pts' => null,
- 'price_usd' => null,
- 'price_vladivostok' => null,
- 'price_moscow' => null,
- 'price_negotiable' => false,
- 'options' => null,
- 'description' => null,
- 'photo_main' => null,
- 'photos_gallery' => null,
- ]));
- }
- $this->command->info('Залито ' . count($cars) . ' автомобилей с drom.ru');
- }
- }
|