Blame view

database/seeders/HousesTableSeeder.php 8.02 KB
242debab8   thesolarwind   Первый коммит в п...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
  <?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();
          }
      }
  }