HousesTableSeeder.php 8.02 KB
<?php

namespace Database\Seeders;

use App\Models\House;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Seeder;

class HousesTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $data = [
            /*1 */[
                'title' => 'Индустриальная недвижимость1',
                'slug' => 'Individual_nedvijimost1',
                'area_id' => 1,
                'area' => 26,
                'type_area_id' => 1,
                'format_area_id' => 1,
                'metro' => 'СтанцияМетро1',
                'description_metro' =>  '5 минут до станции метро',
                'address' => 'ул.Арбатская д.5, оф4',
                'okrug' => 'Округ1',
                'format_house' => 'Аренда',
                'floor' => 5,
                'floor_bild' => 25,
                'price' => 0,
                'rent_in_year' => 280000,
                'rent_in_month' => 2334,
                'object_plan' => '',
                'floor_plan' => '',
            ],
            /*2*/[
                'title' => 'Индустриальная недвижимость2',
                'slug' => 'Individual_nedvijimost2',
                'area_id' => 1,
                'area' => 18,
                'type_area_id' => 2,
                'format_area_id' => 1,
                'metro' => 'СтанцияМетро2',
                'description_metro' =>  '7 минут до станции метро',
                'address' => 'ул.Улица1 д.15, оф67',
                'okrug' => 'Округ1',
                'format_house' => 'Аренда',
                'floor' => 3,
                'floor_bild' => 20,
                'price' => 0,
                'rent_in_year' => 120000,
                'rent_in_month' => 10000,
                'object_plan' => '',
                'floor_plan' => '',
            ],
            /*3*/[
                'title' => 'Индустриальная недвижимость3',
                'slug' => 'Individual_nedvijimost3',
                'area_id' => 1,
                'area' => 37,
                'type_area_id' => 2,
                'format_area_id' => 3,
                'metro' => 'СтанцияМетро3',
                'description_metro' =>  '8 минут до станции метро',
                'address' => 'ул.улица2 д.35, оф6',
                'okrug' => 'Округ2',
                'format_house' => 'Продажа',
                'floor' => 20,
                'floor_bild' => 26,
                'price' => 330000,
                'rent_in_year' => 0,
                'rent_in_month' => 0,
                'object_plan' => '',
                'floor_plan' => '',
            ],

            /*4*/[
                'title' => 'Офис1',
                'slug' => 'ofic1',
                'area_id' => 1,
                'area' => 34,
                'type_area_id' => 2,
                'format_area_id' => 2,
                'metro' => 'СтанцияМетро4',
                'description_metro' =>  '2 минут до станции метро',
                'address' => 'ул.Улица4 д.45, оф45',
                'okrug' => 'Округ1',
                'format_house' => 'Продажа',
                'floor' => 1,
                'floor_bild' => 5,
                'price' => 890000,
                'rent_in_year' => 0,
                'rent_in_month' => 0,
                'object_plan' => '',
                'floor_plan' => '',
            ],

            /*5*/
            [
                'title' => 'Индустриальная недвижимость5',
                'slug' => 'Individual_nedvijimost5',
                'area_id' => 2,
                'area' => 16,
                'type_area_id' => 2,
                'format_area_id' => 1,
                'metro' => 'СтанцияМетро5',
                'description_metro' =>  '15 минут до станции метро',
                'address' => 'ул.Арбатская д.445, оф44',
                'okrug' => 'Округ3',
                'format_house' => 'Аренда',
                'floor' => 7,
                'floor_bild' => 15,
                'price' => 0,
                'rent_in_year' => 250000,
                'rent_in_month' => 2222,
                'object_plan' => '',
                'floor_plan' => '',
            ],

            /*6*/
            [
                'title' => 'Индустриальная недвижимость6',
                'slug' => 'Individual_nedvijimost6',
                'area_id' => 2,
                'area' => 30,
                'type_area_id' => 3,
                'format_area_id' => 2,
                'metro' => 'СтанцияМетро1',
                'description_metro' =>  '10 минут до станции метро',
                'address' => 'ул.Улица д.1, оф1',
                'okrug' => 'Округ12',
                'format_house' => 'Аренда',
                'floor' => 5,
                'floor_bild' => 25,
                'price' => 0,
                'rent_in_year' => 190000,
                'rent_in_month' => 800,
                'object_plan' => '',
                'floor_plan' => '',
            ],

            /*7*/
            [
                'title' => 'Офис7',
                'slug' => 'Individual_nedvijimost7',
                'area_id' => 2,
                'area' => 25,
                'type_area_id' => 1,
                'format_area_id' => 1,
                'metro' => 'СтанцияМетро11',
                'description_metro' =>  '5 минут до станции метро',
                'address' => 'ул.Арбатская д.15, оф14',
                'okrug' => 'Округ11',
                'format_house' => 'Продажа',
                'floor' => 2,
                'floor_bild' => 5,
                'price' => 400000,
                'rent_in_year' => 0,
                'rent_in_month' => 0,
                'object_plan' => '',
                'floor_plan' => '',
            ],

            /*8*/
            [
                'title' => 'Индустриальная недвижимость8',
                'slug' => 'Individual_nedvijimost8',
                'area_id' => 2,
                'area' => 20,
                'type_area_id' => 3,
                'format_area_id' => 3,
                'metro' => 'СтанцияМетро3',
                'description_metro' =>  '12 минут до станции метро',
                'address' => 'ул.Проспект д.55, оф45',
                'okrug' => 'Округ5',
                'format_house' => 'Аренда',
                'floor' => 5,
                'floor_bild' => 21,
                'price' => 0,
                'rent_in_year' => 450000,
                'rent_in_month' => 4000,
                'object_plan' => '',
                'floor_plan' => '',
            ],
        ];

        foreach ($data as $item) {
            $albom = new House();
            $albom->title = $item['title'];
            $albom->slug = $item['slug'];
            $albom->area_id = $item['area_id'];
            $albom->area = $item['area'];
            $albom->type_area_id = $item['type_area_id'];
            $albom->format_area_id = $item['format_area_id'];
            $albom->metro = $item['metro'];
            $albom->description_metro = $item['description_metro'];
            $albom->address = $item['address'];
            $albom->okrug = $item['okrug'];
            $albom->format_house = $item['format_house'];
            $albom->floor = $item['floor'];
            $albom->price = $item['price'];
            $albom->rent_in_year = $item['rent_in_year'];
            $albom->rent_in_month = $item['rent_in_month'];
            $albom->object_plan = $item['object_plan'];
            $albom->floor_plan = $item['floor_plan'];
            $albom->save();
        }
    }
}