Commit f399180fcf731cdf107edd25bddaefb2aed7306f
1 parent
d82a28f22a
Exists in
master
Админка страница офисы и все сопутствующее им
Showing 12 changed files with 848 additions and 18 deletions Inline Diff
- app/Http/Controllers/Admin/HousesController.php
- app/Http/Requests/HousesRequest.php
- app/Models/House.php
- database/migrations/2023_03_01_073202_create_houses_table.php
- database/seeders/HousesTableSeeder.php
- resources/views/admin/houses/add_img.blade.php
- resources/views/admin/houses/create.blade.php
- resources/views/admin/houses/edit.blade.php
- resources/views/admin/houses/form.blade.php
- resources/views/admin/houses/index.blade.php
- resources/views/admin/houses/view_img.blade.php
- routes/web.php
app/Http/Controllers/Admin/HousesController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers\Admin; | 3 | namespace App\Http\Controllers\Admin; |
4 | 4 | ||
5 | use App\Http\Controllers\Controller; | 5 | use App\Http\Controllers\Controller; |
6 | use App\Http\Requests\HousesRequest; | 6 | use App\Http\Requests\HousesRequest; |
7 | use App\Models\Area; | ||
8 | use App\Models\format_area; | ||
9 | use App\Models\foto_house; | ||
7 | use App\Models\House; | 10 | use App\Models\House; |
11 | use App\Models\type_area; | ||
8 | use Illuminate\Http\Request; | 12 | use Illuminate\Http\Request; |
13 | use Illuminate\Support\Facades\Storage; | ||
14 | use Illuminate\Support\Facades\Validator; | ||
9 | 15 | ||
10 | class HousesController extends Controller | 16 | class HousesController extends Controller |
11 | { | 17 | { |
12 | /** | 18 | /** |
13 | * Display a listing of the resource. | 19 | * Display a listing of the resource. |
14 | * | 20 | * |
15 | * @return \Illuminate\Http\Response | 21 | * @return \Illuminate\Http\Response |
16 | */ | 22 | */ |
17 | public function index() | 23 | public function index() |
18 | { | 24 | { |
19 | $houses = House::query()->orderByDesc('created_at')->orderByDesc('id')->paginate(25); | 25 | $houses = House::query()->orderByDesc('created_at')->orderByDesc('id')->paginate(25); |
20 | return view('admin.houses.index', compact('houses')); | 26 | return view('admin.houses.index', compact('houses')); |
21 | 27 | ||
22 | } | 28 | } |
23 | 29 | ||
24 | /** | 30 | /** |
25 | * Show the form for creating a new resource. | 31 | * Show the form for creating a new resource. |
26 | * | 32 | * |
27 | * @return \Illuminate\Http\Response | 33 | * @return \Illuminate\Http\Response |
28 | */ | 34 | */ |
29 | public function create() | 35 | public function create() |
30 | { | 36 | { |
31 | return view('admin.houses.create'); | 37 | $type_areas = type_area::all(); |
38 | $format_areas = format_area::all(); | ||
39 | $areas = Area::all(); | ||
40 | return view('admin.houses.create', compact('areas', 'format_areas', 'type_areas')); | ||
32 | } | 41 | } |
33 | 42 | ||
34 | /** | 43 | /** |
35 | * Store a newly created resource in storage. | 44 | * Store a newly created resource in storage. |
36 | * | 45 | * |
37 | * @param \Illuminate\Http\Request $request | 46 | * @param \Illuminate\Http\Request $request |
38 | * @return \Illuminate\Http\Response | 47 | * @return \Illuminate\Http\Response |
39 | */ | 48 | */ |
40 | public function store(HousesRequest $request) | 49 | public function store(HousesRequest $request) |
41 | { | 50 | { |
42 | $params = $request->all(); | 51 | $params = $request->all(); |
43 | //unset($params['foto_main']); | ||
44 | 52 | ||
45 | if ($request->has('foto_main')) { | 53 | if ($request->has('foto_main')) { |
46 | $params['foto_main'] = $request->file('foto_main')->store('houses', 'public'); | 54 | $params['foto_main'] = $request->file('foto_main')->store('houses', 'public'); |
47 | } | 55 | } |
48 | if ($request->has('object_plan')) { | 56 | if ($request->has('object_plan')) { |
49 | $params['object_plan'] = $request->file('object_plan')->store('houses', 'public'); | 57 | $params['object_plan'] = $request->file('object_plan')->store('houses', 'public'); |
50 | } | 58 | } |
51 | if ($request->has('floor_plan')) { | 59 | if ($request->has('floor_plan')) { |
52 | $params['floor_plan'] = $request->file('floor_plan')->store('houses', 'public'); | 60 | $params['floor_plan'] = $request->file('floor_plan')->store('houses', 'public'); |
53 | } | 61 | } |
62 | if ($request->has('present')) { | ||
63 | $params['present'] = $request->file('present')->store('houses', 'public'); | ||
64 | } | ||
54 | 65 | ||
55 | 66 | ||
56 | House::create($params); | 67 | House::create($params); |
57 | return redirect()->route('admin.houses.index'); | 68 | return redirect()->route('admin.houses.index'); |
58 | } | 69 | } |
59 | 70 | ||
60 | /** | 71 | /** |
61 | * Display the specified resource. | 72 | * Display the specified resource. |
62 | * | 73 | * |
63 | * @param \App\Models\House $house | 74 | * @param \App\Models\House $house |
64 | * @return \Illuminate\Http\Response | 75 | * @return \Illuminate\Http\Response |
65 | */ | 76 | */ |
66 | public function show(House $house) | 77 | public function show(House $house) |
67 | { | 78 | { |
68 | // | 79 | // |
69 | } | 80 | } |
70 | 81 | ||
71 | /** | 82 | /** |
72 | * Show the form for editing the specified resource. | 83 | * Show the form for editing the specified resource. |
73 | * | 84 | * |
74 | * @param \App\Models\House $house | 85 | * @param \App\Models\House $house |
75 | * @return \Illuminate\Http\Response | 86 | * @return \Illuminate\Http\Response |
76 | */ | 87 | */ |
77 | public function edit(House $house) | 88 | public function edit(House $house) |
78 | { | 89 | { |
79 | // | 90 | $type_areas = type_area::all(); |
91 | $format_areas = format_area::all(); | ||
92 | $areas = Area::all(); | ||
93 | return view('admin.houses.edit', | ||
94 | compact('areas', 'format_areas', 'type_areas', 'house')); | ||
95 | |||
80 | } | 96 | } |
81 | 97 | ||
82 | /** | 98 | /** |
83 | * Update the specified resource in storage. | 99 | * Update the specified resource in storage. |
84 | * | 100 | * |
85 | * @param \Illuminate\Http\Request $request | 101 | * @param \Illuminate\Http\Request $request |
86 | * @param \App\Models\House $house | 102 | * @param \App\Models\House $house |
87 | * @return \Illuminate\Http\Response | 103 | * @return \Illuminate\Http\Response |
88 | */ | 104 | */ |
89 | public function update(Request $request, House $house) | 105 | public function update(HousesRequest $request, House $house) |
90 | { | 106 | { |
91 | // | 107 | $params = $request->all(); |
108 | |||
109 | if ($request->has('foto_main')) { | ||
110 | Storage::delete($house->foto_main); | ||
111 | $params['foto_main'] = $request->file('foto_main')->store('houses', 'public'); | ||
112 | } | ||
113 | |||
114 | if ($request->has('object_plan')) { | ||
115 | Storage::delete($house->object_plan); | ||
116 | $params['object_plan'] = $request->file('object_plan')->store('houses', 'public'); | ||
117 | } | ||
118 | |||
119 | if ($request->has('floor_plan')) { | ||
120 | Storage::delete($house->floor_plan); | ||
121 | $params['floor_plan'] = $request->file('floor_plan')->store('houses', 'public'); | ||
122 | } | ||
123 | |||
124 | if ($request->has('present')) { | ||
125 | Storage::delete($house->present); | ||
126 | $params['present'] = $request->file('present')->store('houses', 'public'); | ||
127 | } | ||
128 | |||
129 | $house->update($params); | ||
130 | return redirect()->route('admin.houses.index'); | ||
131 | } | ||
132 | |||
133 | /** | ||
134 | * Просмотр дополнительных картинок | ||
135 | */ | ||
136 | public function view_images(House $house) { | ||
137 | return view('admin.houses.view_img', compact('house')); | ||
138 | } | ||
139 | |||
140 | /** | ||
141 | * Добавление дополнительной картинки у офиса | ||
142 | * @param House $house | ||
143 | * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View | ||
144 | */ | ||
145 | public function add_images(House $house) { | ||
146 | return view('admin.houses.add_img', compact('house')); | ||
147 | } | ||
148 | |||
149 | public function add_images_store(Request $request, House $house) { | ||
150 | $rules = [ | ||
151 | 'foto' => 'required|min:3|max:255', | ||
152 | ]; | ||
153 | $messages = [ | ||
154 | 'required' => 'Укажите обязательное поле', | ||
155 | ]; | ||
156 | |||
157 | $validator = Validator::make($request->all(), $rules, $messages); | ||
158 | |||
159 | if ($validator->fails()) { | ||
160 | return redirect()->route('admin.view.images.houses', ['house' => $house->id]) | ||
161 | ->withErrors($validator); | ||
162 | } else { | ||
163 | $images_house = new foto_house(); | ||
164 | $images_house->house_id = $house->id; | ||
165 | if ($request->has('foto')) { | ||
166 | $images_house->foto = $request->file('foto')->store('houses', 'public'); | ||
167 | } | ||
168 | $images_house->save(); | ||
169 | |||
170 | return redirect()->route('admin.view.images.houses', ['house' => $house->id]); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | public function del_images(House $house, $id) | ||
175 | { | ||
176 | if (!empty($id)) { | ||
177 | $images_house = foto_house::find((int)$id); | ||
178 | $images_house->delete(); | ||
179 | } | ||
180 | return redirect()->route('admin.view.images.houses', ['house' => $house->id]); | ||
92 | } | 181 | } |
93 | 182 | ||
94 | /** | 183 | /** |
95 | * Remove the specified resource from storage. | 184 | * Remove the specified resource from storage. |
96 | * | 185 | * |
97 | * @param \App\Models\House $house | 186 | * @param \App\Models\House $house |
98 | * @return \Illuminate\Http\Response | 187 | * @return \Illuminate\Http\Response |
99 | */ | 188 | */ |
100 | public function destroy(House $house) | 189 | public function destroy(House $house) |
101 | { | 190 | { |
102 | // | 191 | if (!empty($house->foto_main)) { |
192 | Storage::delete($house->foto_main); | ||
193 | } | ||
194 | $house->delete(); | ||
195 | return redirect()->route('admin.houses.index'); | ||
103 | } | 196 | } |
104 | } | 197 | } |
app/Http/Requests/HousesRequest.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Requests; | 3 | namespace App\Http\Requests; |
4 | 4 | ||
5 | use Illuminate\Foundation\Http\FormRequest; | 5 | use Illuminate\Foundation\Http\FormRequest; |
6 | 6 | ||
7 | class HousesRequest extends FormRequest | 7 | class HousesRequest extends FormRequest |
8 | { | 8 | { |
9 | /** | 9 | /** |
10 | * Determine if the user is authorized to make this request. | 10 | * Determine if the user is authorized to make this request. |
11 | * | 11 | * |
12 | * @return bool | 12 | * @return bool |
13 | */ | 13 | */ |
14 | public function authorize() | 14 | public function authorize() |
15 | { | 15 | { |
16 | return false; | 16 | return true; |
17 | } | 17 | } |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Get the validation rules that apply to the request. | 20 | * Get the validation rules that apply to the request. |
21 | * | 21 | * |
22 | * @return array<string, mixed> | 22 | * @return array<string, mixed> |
23 | */ | 23 | */ |
24 | /* ['area_id', 'type_area_id', 'format_area_id', 'metro', 'color_metro', 'foto_main', | ||
25 | 'address', 'okrug', 'articul_area', 'format_house', 'floor', 'description_metro', | ||
26 | 'floor_bild', 'renter', 'uploading_area', 'electric_power', 'travel_card', | ||
27 | 'passing_place', 'separate_input', 'shop_windows', 'place_advertising', 'windows', | ||
28 | 'hood', 'central_heating', 'opening_hours', 'finishing', 'parking', 'price', 'rent_in_year', | ||
29 | 'rent_in_month', 'scheme_deal', 'present', 'object_plan', 'floor_plan', 'description_house', | ||
30 | 'map_coord', 'title', 'area', 'best', 'sos_obj', 'type_plan', 'description_2', | ||
31 | 'price_m2']; | ||
32 | */ | ||
24 | public function rules() | 33 | public function rules() |
25 | { | 34 | { |
26 | return [ | 35 | return [ |
27 | // | 36 | 'title' => [ |
37 | 'required', | ||
38 | 'min:3', | ||
39 | 'max:100', | ||
40 | ], | ||
41 | 'address' => [ | ||
42 | 'required', | ||
43 | 'min:3', | ||
44 | 'max:100', | ||
45 | ], | ||
46 | 'price' => [ | ||
47 | 'required', | ||
48 | 'min:1', | ||
49 | 'max:100', | ||
50 | ], | ||
51 | 'foto_main' => [ | ||
52 | 'mimes:jpeg,jpg,png', | ||
53 | 'max:10000' | ||
54 | ], | ||
28 | ]; | 55 | ]; |
29 | } | 56 | } |
57 | |||
58 | public function messages() { | ||
59 | return [ | ||
60 | 'required' => 'Поле «:attribute» обязательно для заполнения', | ||
61 | 'unique' => 'Такое значение поля «:attribute» уже используется', | ||
62 | 'min' => [ | ||
63 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | ||
64 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | ||
65 | ], | ||
66 | 'max' => [ | ||
67 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | ||
68 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | ||
69 | ], | ||
70 | 'mimes' => 'Файл «:attribute» должен иметь формат :values', | ||
71 | ]; | ||
72 | |||
73 | } | ||
30 | } | 74 | } |
31 | 75 |
app/Models/House.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
6 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
7 | 7 | ||
8 | class House extends Model | 8 | class House extends Model |
9 | { | 9 | { |
10 | use HasFactory; | 10 | use HasFactory; |
11 | 11 | ||
12 | protected $fillable = ['area_id', 'type_area_id', 'format_area_id', 'metro', 'color_metro', 'foto_main', | ||
13 | 'address', 'okrug', 'articul_area', 'format_house', 'floor', 'description_metro', | ||
14 | 'floor_bild', 'renter', 'uploading_area', 'electric_power', 'travel_card', | ||
15 | 'passing_place', 'separate_input', 'shop_windows', 'place_advertising', 'windows', | ||
16 | 'hood', 'central_heating', 'opening_hours', 'finishing', 'parking', 'price', 'rent_in_year', | ||
17 | 'rent_in_month', 'scheme_deal', 'present', 'object_plan', 'floor_plan', 'description_house', | ||
18 | 'map_coord', 'title', 'area', 'best', 'sos_obj', 'type_plan', 'description_2', | ||
19 | 'price_m2']; | ||
20 | |||
21 | |||
12 | /* | 22 | /* |
13 | * Связь таблицы ТИП НЕДВИЖИМОСТИ с таблицей ОФИСЫ | 23 | * Связь таблицы ТИП НЕДВИЖИМОСТИ с таблицей ОФИСЫ |
14 | */ | 24 | */ |
15 | public function typearea() { | 25 | public function typearea() { |
16 | return $this->belongsTo(type_area::class, 'type_area_id'); | 26 | return $this->belongsTo(type_area::class, 'type_area_id'); |
17 | } | 27 | } |
18 | 28 | ||
19 | /* | 29 | /* |
20 | * Связь таблицы ФОРМАТ НЕДВИЖИМОСТИ с таблицей ОФИСЫ | 30 | * Связь таблицы ФОРМАТ НЕДВИЖИМОСТИ с таблицей ОФИСЫ |
21 | */ | 31 | */ |
22 | public function formatarea() { | 32 | public function formatarea() { |
23 | return $this->belongsTo(format_area::class, 'format_area_id'); | 33 | return $this->belongsTo(format_area::class, 'format_area_id'); |
24 | } | 34 | } |
25 | 35 | ||
26 | /* | 36 | /* |
27 | * Связь таблицы ОБЪЕКТЫ НЕДВИЖИМОСТИ с таблицей ОФИСЫ | 37 | * Связь таблицы ОБЪЕКТЫ НЕДВИЖИМОСТИ с таблицей ОФИСЫ |
28 | */ | 38 | */ |
29 | public function areas() { | 39 | public function areas() { |
30 | return $this->belongsTo(Area::class, 'area_id'); | 40 | return $this->belongsTo(Area::class, 'area_id'); |
31 | } | 41 | } |
32 | 42 | ||
33 | /* | 43 | /* |
34 | * Связь таблицы ОФИСЫ с ФОТОГАЛЕРЕЕЙ | 44 | * Связь таблицы ОФИСЫ с ФОТОГАЛЕРЕЕЙ |
35 | */ | 45 | */ |
36 | public function fotohouse() { | 46 | public function fotohouse() { |
37 | return $this->hasMany(foto_house::class); | 47 | return $this->hasMany(foto_house::class); |
38 | } | 48 | } |
39 | } | 49 | } |
40 | 50 |
database/migrations/2023_03_01_073202_create_houses_table.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Illuminate\Database\Migrations\Migration; | 3 | use Illuminate\Database\Migrations\Migration; |
4 | use Illuminate\Database\Schema\Blueprint; | 4 | use Illuminate\Database\Schema\Blueprint; |
5 | use Illuminate\Support\Facades\Schema; | 5 | use Illuminate\Support\Facades\Schema; |
6 | 6 | ||
7 | return new class extends Migration | 7 | return new class extends Migration |
8 | { | 8 | { |
9 | /** | 9 | /** |
10 | * Run the migrations. | 10 | * Run the migrations. |
11 | * | 11 | * |
12 | * @return void | 12 | * @return void |
13 | */ | 13 | */ |
14 | public function up() | 14 | public function up() |
15 | { | 15 | { |
16 | Schema::create('houses', function (Blueprint $table) { | 16 | Schema::create('houses', function (Blueprint $table) { |
17 | $table->id(); | 17 | $table->id(); |
18 | $table->integer('area_id'); | 18 | $table->integer('area_id'); |
19 | $table->integer('type_area_id'); | 19 | $table->integer('type_area_id'); |
20 | $table->integer('format_area_id'); | 20 | $table->integer('format_area_id'); |
21 | $table->string('title', 255)->default(''); | 21 | $table->string('title', 255)->default(''); |
22 | $table->string('slug', 255)->default(''); | 22 | //$table->string('slug', 255)->default(''); |
23 | $table->string('metro', 255)->default(''); | 23 | $table->string('metro', 255)->default(''); |
24 | $table->string('color_metro', 255)->default(''); | 24 | $table->string('color_metro', 255)->default(''); |
25 | $table->string('foto_main', 255)->default(''); | 25 | $table->string('foto_main', 255)->default(''); |
26 | $table->string('address', 255)->default(''); | 26 | $table->string('address', 255)->default(''); |
27 | $table->string('okrug', 255)->default(''); | 27 | $table->string('okrug', 255)->default(''); |
28 | $table->string('articul_area', 255)->default(''); | 28 | $table->string('articul_area', 255)->default(''); |
29 | $table->integer('area')->default(0); | 29 | $table->integer('area')->default(0); |
30 | $table->string('format_house', 50)->default('Аренда'); | 30 | $table->string('format_house', 50)->default('Аренда'); |
31 | $table->integer('floor')->default(1); | 31 | $table->integer('floor')->default(1); |
32 | $table->integer('floor_bild')->default(1); | 32 | $table->integer('floor_bild')->default(1); |
33 | $table->string('renter')->default(''); | 33 | $table->string('renter')->default(''); |
34 | $table->boolean('unloading_area')->default('1'); | 34 | $table->boolean('unloading_area')->default('1'); |
35 | $table->string('electric_power')->default(''); | 35 | $table->string('electric_power')->default(''); |
36 | $table->boolean('travel_card')->default('1'); | 36 | $table->boolean('travel_card')->default('1'); |
37 | $table->boolean('passing_place')->default('1'); | 37 | $table->boolean('passing_place')->default('1'); |
38 | $table->boolean('separate_input')->default('1'); | 38 | $table->boolean('separate_input')->default('1'); |
39 | $table->boolean('shop_windows')->default('1'); | 39 | $table->boolean('shop_windows')->default('1'); |
40 | $table->boolean('place_advertising')->default('1'); | 40 | $table->boolean('place_advertising')->default('1'); |
41 | $table->integer('windows')->default('1'); | 41 | $table->integer('windows')->default('1'); |
42 | $table->boolean('hood')->default('1'); | 42 | $table->boolean('hood')->default('1'); |
43 | $table->boolean('central_heating')->default('1'); | 43 | $table->boolean('central_heating')->default('1'); |
44 | $table->string('opening_hours')->default(''); | 44 | $table->string('opening_hours')->default(''); |
45 | $table->boolean('finishing')->default('1'); | 45 | $table->boolean('finishing')->default('1'); |
46 | $table->integer('parking')->default(15); | 46 | $table->integer('parking')->default(15); |
47 | $table->integer('price')->default(0); | 47 | $table->integer('price')->default(0); |
48 | $table->integer('price_m2')->default(0); | 48 | $table->integer('price_m2')->default(0); |
49 | $table->integer('rent_in_year')->default(0); | 49 | $table->integer('rent_in_year')->default(0); |
50 | $table->integer('rent_in_month')->default(0); | 50 | $table->integer('rent_in_month')->default(0); |
51 | $table->string('scheme_deal', 255)->default('Прямая аренда'); | 51 | $table->string('scheme_deal', 255)->default('Прямая аренда'); |
52 | $table->string('present', 255)->default(''); | 52 | $table->string('present', 255)->default(''); |
53 | $table->string('object_plan', 255)->default(''); | 53 | $table->string('object_plan', 255)->default(''); |
54 | $table->string('floor_plan', 255)->default(''); | 54 | $table->string('floor_plan', 255)->default(''); |
55 | $table->string('description_metro', 255); | 55 | $table->string('description_metro', 255); |
56 | $table->text('description_house')->nullable(true); | 56 | $table->text('description_house')->nullable(true); |
57 | $table->string('map_coord', 255)->default(''); | 57 | $table->string('map_coord', 255)->default(''); |
58 | $table->boolean('best')->default('0'); | 58 | $table->boolean('best')->default('0'); |
59 | $table->string('description_2')->default(''); | 59 | $table->string('description_2')->default(''); |
60 | $table->string('sos_obj')->default('Рабочая'); | 60 | $table->string('sos_obj')->default('Рабочая'); |
61 | $table->string('type_plan')->default('Открытая'); | 61 | $table->string('type_plan')->default('Открытая'); |
62 | 62 | ||
63 | $table->timestamps(); | 63 | $table->timestamps(); |
64 | }); | 64 | }); |
65 | } | 65 | } |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * Reverse the migrations. | 68 | * Reverse the migrations. |
69 | * | 69 | * |
70 | * @return void | 70 | * @return void |
71 | */ | 71 | */ |
72 | public function down() | 72 | public function down() |
73 | { | 73 | { |
74 | Schema::dropIfExists('houses'); | 74 | Schema::dropIfExists('houses'); |
75 | } | 75 | } |
76 | }; | 76 | }; |
77 | 77 |
database/seeders/HousesTableSeeder.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Database\Seeders; | 3 | namespace Database\Seeders; |
4 | 4 | ||
5 | use App\Models\House; | 5 | use App\Models\House; |
6 | use Illuminate\Database\Console\Seeds\WithoutModelEvents; | 6 | use Illuminate\Database\Console\Seeds\WithoutModelEvents; |
7 | use Illuminate\Database\Eloquent\Model; | 7 | use Illuminate\Database\Eloquent\Model; |
8 | use Illuminate\Database\Seeder; | 8 | use Illuminate\Database\Seeder; |
9 | 9 | ||
10 | class HousesTableSeeder extends Seeder | 10 | class HousesTableSeeder extends Seeder |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | * Run the database seeds. | 13 | * Run the database seeds. |
14 | * | 14 | * |
15 | * @return void | 15 | * @return void |
16 | */ | 16 | */ |
17 | public function run() | 17 | public function run() |
18 | { | 18 | { |
19 | $data = [ | 19 | $data = [ |
20 | /*1 */[ | 20 | /*1 */[ |
21 | 'title' => 'Индустриальная недвижимость1', | 21 | 'title' => 'Индустриальная недвижимость1', |
22 | 'slug' => 'Individual_nedvijimost1', | 22 | //'slug' => 'Individual_nedvijimost1', |
23 | 'area_id' => 1, | 23 | 'area_id' => 1, |
24 | 'area' => 26, | 24 | 'area' => 26, |
25 | 'type_area_id' => 1, | 25 | 'type_area_id' => 1, |
26 | 'format_area_id' => 1, | 26 | 'format_area_id' => 1, |
27 | 'metro' => 'СтанцияМетро1', | 27 | 'metro' => 'СтанцияМетро1', |
28 | 'description_metro' => '5 минут до станции метро', | 28 | 'description_metro' => '5 минут до станции метро', |
29 | 'address' => 'ул.Арбатская д.5, оф4', | 29 | 'address' => 'ул.Арбатская д.5, оф4', |
30 | 'okrug' => 'Округ1', | 30 | 'okrug' => 'Округ1', |
31 | 'format_house' => 'Аренда', | 31 | 'format_house' => 'Аренда', |
32 | 'floor' => 5, | 32 | 'floor' => 5, |
33 | 'floor_bild' => 25, | 33 | 'floor_bild' => 25, |
34 | 'price' => 2334, | 34 | 'price' => 2334, |
35 | 'rent_in_year' => 280000, | 35 | 'rent_in_year' => 280000, |
36 | 'rent_in_month' => 0, | 36 | 'rent_in_month' => 0, |
37 | 'object_plan' => '', | 37 | 'object_plan' => '', |
38 | 'floor_plan' => '', | 38 | 'floor_plan' => '', |
39 | 'foto_main' => 'images/card/card-img-1.jpg', | 39 | 'foto_main' => 'images/card/card-img-1.jpg', |
40 | ], | 40 | ], |
41 | /*2*/[ | 41 | /*2*/[ |
42 | 'title' => 'Индустриальная недвижимость2', | 42 | 'title' => 'Индустриальная недвижимость2', |
43 | 'slug' => 'Individual_nedvijimost2', | 43 | //'slug' => 'Individual_nedvijimost2', |
44 | 'area_id' => 1, | 44 | 'area_id' => 1, |
45 | 'area' => 18, | 45 | 'area' => 18, |
46 | 'type_area_id' => 2, | 46 | 'type_area_id' => 2, |
47 | 'format_area_id' => 1, | 47 | 'format_area_id' => 1, |
48 | 'metro' => 'СтанцияМетро2', | 48 | 'metro' => 'СтанцияМетро2', |
49 | 'description_metro' => '7 минут до станции метро', | 49 | 'description_metro' => '7 минут до станции метро', |
50 | 'address' => 'ул.Улица1 д.15, оф67', | 50 | 'address' => 'ул.Улица1 д.15, оф67', |
51 | 'okrug' => 'Округ1', | 51 | 'okrug' => 'Округ1', |
52 | 'format_house' => 'Аренда', | 52 | 'format_house' => 'Аренда', |
53 | 'floor' => 3, | 53 | 'floor' => 3, |
54 | 'floor_bild' => 20, | 54 | 'floor_bild' => 20, |
55 | 'price' => 10000, | 55 | 'price' => 10000, |
56 | 'rent_in_year' => 120000, | 56 | 'rent_in_year' => 120000, |
57 | 'rent_in_month' => 0, | 57 | 'rent_in_month' => 0, |
58 | 'object_plan' => '', | 58 | 'object_plan' => '', |
59 | 'floor_plan' => '', | 59 | 'floor_plan' => '', |
60 | 'foto_main' => 'images/card/card-img-2.jpg', | 60 | 'foto_main' => 'images/card/card-img-2.jpg', |
61 | ], | 61 | ], |
62 | /*3*/[ | 62 | /*3*/[ |
63 | 'title' => 'Индустриальная недвижимость3', | 63 | 'title' => 'Индустриальная недвижимость3', |
64 | 'slug' => 'Individual_nedvijimost3', | 64 | //'slug' => 'Individual_nedvijimost3', |
65 | 'area_id' => 1, | 65 | 'area_id' => 1, |
66 | 'area' => 37, | 66 | 'area' => 37, |
67 | 'type_area_id' => 2, | 67 | 'type_area_id' => 2, |
68 | 'format_area_id' => 3, | 68 | 'format_area_id' => 3, |
69 | 'metro' => 'СтанцияМетро3', | 69 | 'metro' => 'СтанцияМетро3', |
70 | 'description_metro' => '8 минут до станции метро', | 70 | 'description_metro' => '8 минут до станции метро', |
71 | 'address' => 'ул.улица2 д.35, оф6', | 71 | 'address' => 'ул.улица2 д.35, оф6', |
72 | 'okrug' => 'Округ2', | 72 | 'okrug' => 'Округ2', |
73 | 'format_house' => 'Продажа', | 73 | 'format_house' => 'Продажа', |
74 | 'floor' => 20, | 74 | 'floor' => 20, |
75 | 'floor_bild' => 26, | 75 | 'floor_bild' => 26, |
76 | 'price' => 330000, | 76 | 'price' => 330000, |
77 | 'rent_in_year' => 0, | 77 | 'rent_in_year' => 0, |
78 | 'rent_in_month' => 0, | 78 | 'rent_in_month' => 0, |
79 | 'object_plan' => '', | 79 | 'object_plan' => '', |
80 | 'floor_plan' => '', | 80 | 'floor_plan' => '', |
81 | 'foto_main' => 'images/card/card-img-3.jpg', | 81 | 'foto_main' => 'images/card/card-img-3.jpg', |
82 | ], | 82 | ], |
83 | 83 | ||
84 | /*4*/[ | 84 | /*4*/[ |
85 | 'title' => 'Офис1', | 85 | 'title' => 'Офис1', |
86 | 'slug' => 'ofic1', | 86 | //'slug' => 'ofic1', |
87 | 'area_id' => 1, | 87 | 'area_id' => 1, |
88 | 'area' => 34, | 88 | 'area' => 34, |
89 | 'type_area_id' => 2, | 89 | 'type_area_id' => 2, |
90 | 'format_area_id' => 2, | 90 | 'format_area_id' => 2, |
91 | 'metro' => 'СтанцияМетро4', | 91 | 'metro' => 'СтанцияМетро4', |
92 | 'description_metro' => '2 минут до станции метро', | 92 | 'description_metro' => '2 минут до станции метро', |
93 | 'address' => 'ул.Улица4 д.45, оф45', | 93 | 'address' => 'ул.Улица4 д.45, оф45', |
94 | 'okrug' => 'Округ1', | 94 | 'okrug' => 'Округ1', |
95 | 'format_house' => 'Продажа', | 95 | 'format_house' => 'Продажа', |
96 | 'floor' => 1, | 96 | 'floor' => 1, |
97 | 'floor_bild' => 5, | 97 | 'floor_bild' => 5, |
98 | 'price' => 890000, | 98 | 'price' => 890000, |
99 | 'rent_in_year' => 0, | 99 | 'rent_in_year' => 0, |
100 | 'rent_in_month' => 0, | 100 | 'rent_in_month' => 0, |
101 | 'object_plan' => '', | 101 | 'object_plan' => '', |
102 | 'floor_plan' => '', | 102 | 'floor_plan' => '', |
103 | 'foto_main' => 'images/card/card-img-4.jpg', | 103 | 'foto_main' => 'images/card/card-img-4.jpg', |
104 | ], | 104 | ], |
105 | 105 | ||
106 | /*5*/ | 106 | /*5*/ |
107 | [ | 107 | [ |
108 | 'title' => 'Индустриальная недвижимость5', | 108 | 'title' => 'Индустриальная недвижимость5', |
109 | 'slug' => 'Individual_nedvijimost5', | 109 | // 'slug' => 'Individual_nedvijimost5', |
110 | 'area_id' => 2, | 110 | 'area_id' => 2, |
111 | 'area' => 16, | 111 | 'area' => 16, |
112 | 'type_area_id' => 2, | 112 | 'type_area_id' => 2, |
113 | 'format_area_id' => 1, | 113 | 'format_area_id' => 1, |
114 | 'metro' => 'СтанцияМетро5', | 114 | 'metro' => 'СтанцияМетро5', |
115 | 'description_metro' => '15 минут до станции метро', | 115 | 'description_metro' => '15 минут до станции метро', |
116 | 'address' => 'ул.Арбатская д.445, оф44', | 116 | 'address' => 'ул.Арбатская д.445, оф44', |
117 | 'okrug' => 'Округ3', | 117 | 'okrug' => 'Округ3', |
118 | 'format_house' => 'Аренда', | 118 | 'format_house' => 'Аренда', |
119 | 'floor' => 7, | 119 | 'floor' => 7, |
120 | 'floor_bild' => 15, | 120 | 'floor_bild' => 15, |
121 | 'price' => 2222, | 121 | 'price' => 2222, |
122 | 'rent_in_year' => 250000, | 122 | 'rent_in_year' => 250000, |
123 | 'rent_in_month' => 0, | 123 | 'rent_in_month' => 0, |
124 | 'object_plan' => '', | 124 | 'object_plan' => '', |
125 | 'floor_plan' => '', | 125 | 'floor_plan' => '', |
126 | 'foto_main' => '', | 126 | 'foto_main' => '', |
127 | ], | 127 | ], |
128 | 128 | ||
129 | /*6*/ | 129 | /*6*/ |
130 | [ | 130 | [ |
131 | 'title' => 'Индустриальная недвижимость6', | 131 | 'title' => 'Индустриальная недвижимость6', |
132 | 'slug' => 'Individual_nedvijimost6', | 132 | //'slug' => 'Individual_nedvijimost6', |
133 | 'area_id' => 2, | 133 | 'area_id' => 2, |
134 | 'area' => 30, | 134 | 'area' => 30, |
135 | 'type_area_id' => 3, | 135 | 'type_area_id' => 3, |
136 | 'format_area_id' => 2, | 136 | 'format_area_id' => 2, |
137 | 'metro' => 'СтанцияМетро1', | 137 | 'metro' => 'СтанцияМетро1', |
138 | 'description_metro' => '10 минут до станции метро', | 138 | 'description_metro' => '10 минут до станции метро', |
139 | 'address' => 'ул.Улица д.1, оф1', | 139 | 'address' => 'ул.Улица д.1, оф1', |
140 | 'okrug' => 'Округ12', | 140 | 'okrug' => 'Округ12', |
141 | 'format_house' => 'Аренда', | 141 | 'format_house' => 'Аренда', |
142 | 'floor' => 5, | 142 | 'floor' => 5, |
143 | 'floor_bild' => 25, | 143 | 'floor_bild' => 25, |
144 | 'price' => 800, | 144 | 'price' => 800, |
145 | 'rent_in_year' => 190000, | 145 | 'rent_in_year' => 190000, |
146 | 'rent_in_month' => 0, | 146 | 'rent_in_month' => 0, |
147 | 'object_plan' => '', | 147 | 'object_plan' => '', |
148 | 'floor_plan' => '', | 148 | 'floor_plan' => '', |
149 | 'foto_main' => 'images/card/card-img-5.jpg', | 149 | 'foto_main' => 'images/card/card-img-5.jpg', |
150 | ], | 150 | ], |
151 | 151 | ||
152 | /*7*/ | 152 | /*7*/ |
153 | [ | 153 | [ |
154 | 'title' => 'Офис7', | 154 | 'title' => 'Офис7', |
155 | 'slug' => 'Individual_nedvijimost7', | 155 | //'slug' => 'Individual_nedvijimost7', |
156 | 'area_id' => 2, | 156 | 'area_id' => 2, |
157 | 'area' => 25, | 157 | 'area' => 25, |
158 | 'type_area_id' => 1, | 158 | 'type_area_id' => 1, |
159 | 'format_area_id' => 1, | 159 | 'format_area_id' => 1, |
160 | 'metro' => 'СтанцияМетро11', | 160 | 'metro' => 'СтанцияМетро11', |
161 | 'description_metro' => '5 минут до станции метро', | 161 | 'description_metro' => '5 минут до станции метро', |
162 | 'address' => 'ул.Арбатская д.15, оф14', | 162 | 'address' => 'ул.Арбатская д.15, оф14', |
163 | 'okrug' => 'Округ11', | 163 | 'okrug' => 'Округ11', |
164 | 'format_house' => 'Продажа', | 164 | 'format_house' => 'Продажа', |
165 | 'floor' => 2, | 165 | 'floor' => 2, |
166 | 'floor_bild' => 5, | 166 | 'floor_bild' => 5, |
167 | 'price' => 400000, | 167 | 'price' => 400000, |
168 | 'rent_in_year' => 0, | 168 | 'rent_in_year' => 0, |
169 | 'rent_in_month' => 0, | 169 | 'rent_in_month' => 0, |
170 | 'object_plan' => '', | 170 | 'object_plan' => '', |
171 | 'floor_plan' => '', | 171 | 'floor_plan' => '', |
172 | 'foto_main' => 'images/card/card-img-6.jpg', | 172 | 'foto_main' => 'images/card/card-img-6.jpg', |
173 | ], | 173 | ], |
174 | 174 | ||
175 | /*8*/ | 175 | /*8*/ |
176 | [ | 176 | [ |
177 | 'title' => 'Индустриальная недвижимость8', | 177 | 'title' => 'Индустриальная недвижимость8', |
178 | 'slug' => 'Individual_nedvijimost8', | 178 | //'slug' => 'Individual_nedvijimost8', |
179 | 'area_id' => 2, | 179 | 'area_id' => 2, |
180 | 'area' => 20, | 180 | 'area' => 20, |
181 | 'type_area_id' => 3, | 181 | 'type_area_id' => 3, |
182 | 'format_area_id' => 3, | 182 | 'format_area_id' => 3, |
183 | 'metro' => 'СтанцияМетро3', | 183 | 'metro' => 'СтанцияМетро3', |
184 | 'description_metro' => '12 минут до станции метро', | 184 | 'description_metro' => '12 минут до станции метро', |
185 | 'address' => 'ул.Проспект д.55, оф45', | 185 | 'address' => 'ул.Проспект д.55, оф45', |
186 | 'okrug' => 'Округ5', | 186 | 'okrug' => 'Округ5', |
187 | 'format_house' => 'Аренда', | 187 | 'format_house' => 'Аренда', |
188 | 'floor' => 5, | 188 | 'floor' => 5, |
189 | 'floor_bild' => 21, | 189 | 'floor_bild' => 21, |
190 | 'price' => 4000, | 190 | 'price' => 4000, |
191 | 'rent_in_year' => 450000, | 191 | 'rent_in_year' => 450000, |
192 | 'rent_in_month' => 0, | 192 | 'rent_in_month' => 0, |
193 | 'object_plan' => '', | 193 | 'object_plan' => '', |
194 | 'floor_plan' => '', | 194 | 'floor_plan' => '', |
195 | 'foto_main' => 'images/card/card-img-7.jpg', | 195 | 'foto_main' => 'images/card/card-img-7.jpg', |
196 | ], | 196 | ], |
197 | ]; | 197 | ]; |
198 | 198 | ||
199 | foreach ($data as $item) { | 199 | foreach ($data as $item) { |
200 | $albom = new House(); | 200 | $albom = new House(); |
201 | $albom->title = $item['title']; | 201 | $albom->title = $item['title']; |
202 | $albom->slug = $item['slug']; | 202 | //$albom->slug = $item['slug']; |
203 | $albom->area_id = $item['area_id']; | 203 | $albom->area_id = $item['area_id']; |
204 | $albom->area = $item['area']; | 204 | $albom->area = $item['area']; |
205 | $albom->type_area_id = $item['type_area_id']; | 205 | $albom->type_area_id = $item['type_area_id']; |
206 | $albom->format_area_id = $item['format_area_id']; | 206 | $albom->format_area_id = $item['format_area_id']; |
207 | $albom->metro = $item['metro']; | 207 | $albom->metro = $item['metro']; |
208 | $albom->description_metro = $item['description_metro']; | 208 | $albom->description_metro = $item['description_metro']; |
209 | $albom->address = $item['address']; | 209 | $albom->address = $item['address']; |
210 | $albom->okrug = $item['okrug']; | 210 | $albom->okrug = $item['okrug']; |
211 | $albom->format_house = $item['format_house']; | 211 | $albom->format_house = $item['format_house']; |
212 | $albom->floor = $item['floor']; | 212 | $albom->floor = $item['floor']; |
213 | $albom->price = $item['price']; | 213 | $albom->price = $item['price']; |
214 | $albom->rent_in_year = $item['rent_in_year']; | 214 | $albom->rent_in_year = $item['rent_in_year']; |
215 | $albom->rent_in_month = $item['rent_in_month']; | 215 | $albom->rent_in_month = $item['rent_in_month']; |
216 | $albom->object_plan = $item['object_plan']; | 216 | $albom->object_plan = $item['object_plan']; |
217 | $albom->floor_plan = $item['floor_plan']; | 217 | $albom->floor_plan = $item['floor_plan']; |
218 | $albom->foto_main = $item['foto_main']; | 218 | $albom->foto_main = $item['foto_main']; |
219 | $albom->save(); | 219 | $albom->save(); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 |
resources/views/admin/houses/add_img.blade.php
File was created | 1 | @extends('layout.admin', ['title' => 'Добавление картинки офиса']) | |
2 | |||
3 | @section('content') | ||
4 | <section class="favorites"> | ||
5 | <div class="favorites-top"> | ||
6 | <div class="container"> | ||
7 | <div class="breadcrumbs"> | ||
8 | <ul class="breadcrumbs__list"> | ||
9 | <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('user.index') }}">Главная</a></li> | ||
10 | <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('admin.houses.index') }}">Офисы </a></li> | ||
11 | <li class="breadcrumbs__item"><span class="breadcrumbs__link">Добавление доп.картинки офиса </span></li> | ||
12 | </ul> | ||
13 | </div> | ||
14 | <h1 class="favorites__title title-main">Добавление доп.картинки офиса</h1> | ||
15 | </div> | ||
16 | </div> | ||
17 | <div class="favorites-cnt"> | ||
18 | <div class="container"> | ||
19 | <h3>Название: {{ $house->title }} ID: ({{ $house->id }})</h3> | ||
20 | <form method="post" enctype="multipart/form-data" action="{{ route('admin.add.image.post.houses', ['house' => $house->id]) }}" style="width:100%"> | ||
21 | @csrf | ||
22 | <label for="foto">Файл-картинка:</label> | ||
23 | <input type="file" class="form-control-file txt" name="foto" id="foto" accept="image/png, image/jpeg"> | ||
24 | |||
25 | <br><br> | ||
26 | <button type="submit" class="btn hero-search__btn btn--main">Сохранить</button> | ||
27 | </form> | ||
28 | </div> | ||
29 | </div> | ||
30 | </section> | ||
31 | @endsection | ||
32 |
resources/views/admin/houses/create.blade.php
1 | @extends('layout.admin', ['title' => 'Создание офиса']) | ||
2 | |||
3 | @section('content') | ||
4 | <section class="favorites"> | ||
5 | <div class="favorites-top"> | ||
6 | <div class="container"> | ||
7 | <div class="breadcrumbs"> | ||
8 | <ul class="breadcrumbs__list"> | ||
9 | <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('user.index') }}">Главная</a></li> | ||
10 | <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('admin.houses.index') }}">Офисы </a></li> | ||
11 | <li class="breadcrumbs__item"><span class="breadcrumbs__link">Создание офиса </span></li> | ||
12 | </ul> | ||
13 | </div> | ||
14 | <h1 class="favorites__title title-main">Создание офиса</h1> | ||
15 | </div> | ||
16 | </div> | ||
17 | <div class="favorites-cnt"> | ||
18 | <div class="container"> | ||
19 | <form method="post" enctype="multipart/form-data" action="{{ route('admin.houses.store') }}" style="width:100%"> | ||
20 | @include('admin.houses.form') | ||
21 | </form> | ||
22 | </div> | ||
23 | </div> | ||
24 | </section> | ||
25 | @endsection | ||
26 |
resources/views/admin/houses/edit.blade.php
1 | @extends('layout.admin', ['title' => 'Редактирование офиса']) | ||
2 | |||
3 | @section('content') | ||
4 | <section class="favorites"> | ||
5 | <div class="favorites-top"> | ||
6 | <div class="container"> | ||
7 | <div class="breadcrumbs"> | ||
8 | <ul class="breadcrumbs__list"> | ||
9 | <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('user.index') }}">Главная</a></li> | ||
10 | <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('admin.houses.index') }}">Офисы </a></li> | ||
11 | <li class="breadcrumbs__item"><span class="breadcrumbs__link">Редактирование офиса </span></li> | ||
12 | </ul> | ||
13 | </div> | ||
14 | <h1 class="favorites__title title-main">Редактирование офиса</h1> | ||
15 | </div> | ||
16 | </div> | ||
17 | <div class="favorites-cnt"> | ||
18 | <div class="container"> | ||
19 | <form method="post" enctype="multipart/form-data" action="{{ route('admin.houses.update', ['house' => $house->id])}}" style="width:100%"> | ||
20 | @include('admin.houses.form') | ||
21 | </form> | ||
22 | </div> | ||
23 | </div> | ||
24 | </section> | ||
25 | @endsection | ||
26 |
resources/views/admin/houses/form.blade.php
1 | @csrf | ||
2 | |||
3 | @isset($house) | ||
4 | @method('PUT') | ||
5 | @endisset | ||
6 | |||
7 | <label for="title">Заголовок офиса: <span class="req">*</span></label><br> | ||
8 | @error('title') | ||
9 | <div class="alert alert-danger">{{ $message }}</div> | ||
10 | @enderror | ||
11 | <input type="text" class="form-control_ txt" name="title" placeholder="Название офиса" | ||
12 | required maxlength="100" style="width: 80%" value="{{ old('title') ?? $house->title ?? '' }}"><br><br> | ||
13 | |||
14 | <label for="best">Лучшее предложение: </label><br> | ||
15 | @error('best') | ||
16 | <div class="alert alert-danger">{{ $message }}</div> | ||
17 | @enderror | ||
18 | <select name="best" id="best" class="form-control"> | ||
19 | <option value="1" | ||
20 | @isset($house) | ||
21 | @if($house->best == '1') | ||
22 | selected | ||
23 | @endif | ||
24 | @endisset | ||
25 | >Да</option> | ||
26 | <option value="0" | ||
27 | @isset($house) | ||
28 | @if($house->best == '0') | ||
29 | selected | ||
30 | @endif | ||
31 | @endisset | ||
32 | >Нет</option> | ||
33 | </select><br><br> | ||
34 | |||
35 | <label for="area_id">Объект недвижимости (ЖК): <span class="req">*</span></label><br> | ||
36 | @error('area_id') | ||
37 | <div class="alert alert-danger">{{ $message }}</div> | ||
38 | @enderror | ||
39 | <select name="area_id" id="area_id" class="form-control"> | ||
40 | @foreach($areas as $area) | ||
41 | <option value="{{ $area->id }}" | ||
42 | @isset($house) | ||
43 | @if($house->area_id == $area->id) | ||
44 | selected | ||
45 | @endif | ||
46 | @endisset | ||
47 | >{{ $area->name_area }}</option> | ||
48 | @endforeach | ||
49 | </select><br><br> | ||
50 | |||
51 | <label for="type_area_id">Тип недвижимости: <span class="req">*</span></label><br> | ||
52 | @error('type_area_id') | ||
53 | <div class="alert alert-danger">{{ $message }}</div> | ||
54 | @enderror | ||
55 | <select name="type_area_id" id="type_area_id" class="form-control"> | ||
56 | @foreach($type_areas as $tarea) | ||
57 | <option value="{{ $tarea->id }}" | ||
58 | @isset($house) | ||
59 | @if($house->type_area_id == $tarea->id) | ||
60 | selected | ||
61 | @endif | ||
62 | @endisset | ||
63 | >{{ $tarea->name_type }}</option> | ||
64 | @endforeach | ||
65 | </select><br><br> | ||
66 | |||
67 | <label for="format_area_id">Формат недвижимости: <span class="req">*</span></label><br> | ||
68 | @error('format_area_id') | ||
69 | <div class="alert alert-danger">{{ $message }}</div> | ||
70 | @enderror | ||
71 | <select name="format_area_id" id="format_area_id" class="form-control"> | ||
72 | @foreach($format_areas as $farea) | ||
73 | <option value="{{ $farea->id }}" | ||
74 | @isset($house) | ||
75 | @if($house->format_area_id == $farea->id) | ||
76 | selected | ||
77 | @endif | ||
78 | @endisset | ||
79 | >{{ $farea->name_format }}</option> | ||
80 | @endforeach | ||
81 | </select><br><br> | ||
82 | |||
83 | <label for="metro">Метро: <span class="req">*</span></label><br> | ||
84 | @error('metro') | ||
85 | <div class="alert alert-danger">{{ $message }}</div> | ||
86 | @enderror | ||
87 | <input type="text" class="form-control_ txt" name="metro" placeholder="Название метро" | ||
88 | required maxlength="100" style="width: 80%" value="{{ old('metro') ?? $house->metro ?? '' }}"><br><br> | ||
89 | |||
90 | <label for="description_metro">Удаленность метро: </label><br> | ||
91 | @error('description_metro') | ||
92 | <div class="alert alert-danger">{{ $message }}</div> | ||
93 | @enderror | ||
94 | <input type="text" class="form-control_ txt" name="description_metro" placeholder="Удаленность метро" | ||
95 | required maxlength="100" style="width: 80%" value="{{ old('description_metro') ?? $house->description_metro ?? '' }}"><br><br> | ||
96 | |||
97 | <label for="address">Адрес: <span class="req">*</span></label><br> | ||
98 | @error('address') | ||
99 | <div class="alert alert-danger">{{ $message }}</div> | ||
100 | @enderror | ||
101 | <input type="text" class="form-control_ txt" name="address" placeholder="Адрес" | ||
102 | required maxlength="100" style="width: 80%" value="{{ old('address') ?? $house->address ?? '' }}"><br><br> | ||
103 | |||
104 | <label for="okrug">Округ: <span class="req">*</span></label><br> | ||
105 | @error('okrug') | ||
106 | <div class="alert alert-danger">{{ $message }}</div> | ||
107 | @enderror | ||
108 | <input type="text" class="form-control_ txt" name="okrug" placeholder="Округ" | ||
109 | required maxlength="100" style="width: 80%" value="{{ old('okrug') ?? $house->okrug ?? '' }}"><br><br> | ||
110 | |||
111 | <label for="foto_main">Файл-картинка:</label><br> | ||
112 | <input type="file" class="form-control-file txt" name="foto_main" id="foto_main" accept="image/png, image/jpeg"><br> | ||
113 | |||
114 | @isset($house->foto_main) | ||
115 | <div class="form-group form-check"> | ||
116 | <img src="<?=asset(Storage::url($house->foto_main))?>" width="100px"/> | ||
117 | <input type="checkbox" class="form-check-input" name="remove" id="remove"> | ||
118 | <label class="form-check-label" for="remove"> | ||
119 | Удалить загруженное изображение | ||
120 | </label> | ||
121 | </div> | ||
122 | @endisset | ||
123 | <br> | ||
124 | |||
125 | <label for="articul_area">Артикул помещения: </label><br> | ||
126 | @error('articul_area') | ||
127 | <div class="alert alert-danger">{{ $message }}</div> | ||
128 | @enderror | ||
129 | <input type="text" class="form-control_ txt" name="articul_area" placeholder="Артикул помещения" | ||
130 | required maxlength="100" style="width: 80%" value="{{ old('articul_area') ?? $house->articul_area ?? '' }}"><br><br> | ||
131 | |||
132 | <label for="format_house">Формат помещения: <span class="req">*</span></label><br> | ||
133 | @error('format_house') | ||
134 | <div class="alert alert-danger">{{ $message }}</div> | ||
135 | @enderror | ||
136 | <select name="format_house" id="format_house" class="form-control"> | ||
137 | <option value="Аренда" | ||
138 | @isset($house) | ||
139 | @if($house->format_house == 'Аренда') | ||
140 | selected | ||
141 | @endif | ||
142 | @endisset | ||
143 | >Аренда</option> | ||
144 | <option value="Продажа" | ||
145 | @isset($house) | ||
146 | @if($house->format_house == 'Продажа') | ||
147 | selected | ||
148 | @endif | ||
149 | @endisset | ||
150 | >Продажа</option> | ||
151 | <option value="Бизнес" | ||
152 | @isset($house) | ||
153 | @if($house->format_house == 'Бизнес') | ||
154 | selected | ||
155 | @endif | ||
156 | @endisset | ||
157 | >Бизнес</option> | ||
158 | <option value="Арендованные" | ||
159 | @isset($house) | ||
160 | @if($house->format_house == 'Арендованные') | ||
161 | selected | ||
162 | @endif | ||
163 | @endisset | ||
164 | >Арендованные</option> | ||
165 | </select><br><br> | ||
166 | |||
167 | <label for="area">Площадь помещения: <span class="req">*</span></label><br> | ||
168 | @error('area') | ||
169 | <div class="alert alert-danger">{{ $message }}</div> | ||
170 | @enderror | ||
171 | <input type="text" class="form-control_ txt" name="area" placeholder="Площадь помещения" | ||
172 | required maxlength="100" style="width: 80%" value="{{ old('area') ?? $house->area ?? '' }}"><br><br> | ||
173 | |||
174 | <label for="floor">Этаж: </label><br> | ||
175 | @error('floor') | ||
176 | <div class="alert alert-danger">{{ $message }}</div> | ||
177 | @enderror | ||
178 | <input type="text" class="form-control_ txt" name="floor" placeholder="Этаж" | ||
179 | required maxlength="100" style="width: 80%" value="{{ old('floor') ?? $house->floor ?? '' }}"><br><br> | ||
180 | |||
181 | <label for="floor_bild">Этажность здания: </label><br> | ||
182 | @error('floor_bild') | ||
183 | <div class="alert alert-danger">{{ $message }}</div> | ||
184 | @enderror | ||
185 | <input type="text" class="form-control_ txt" name="floor_bild" placeholder="Этажность здания" | ||
186 | required maxlength="100" style="width: 80%" value="{{ old('floor_bild') ?? $house->floor_bild ?? '' }}"><br><br> | ||
187 | |||
188 | <label for="renter">Арендатор (поле только для аренды и арендованные): </label><br> | ||
189 | @error('renter') | ||
190 | <div class="alert alert-danger">{{ $message }}</div> | ||
191 | @enderror | ||
192 | <input type="text" class="form-control_ txt" name="renter" placeholder="Арендатор" | ||
193 | required maxlength="100" style="width: 80%" value="{{ old('renter') ?? $house->renter ?? '' }}"><br><br> | ||
194 | |||
195 | <label for="price">Цена: </label><br> | ||
196 | @error('price') | ||
197 | <div class="alert alert-danger">{{ $message }}</div> | ||
198 | @enderror | ||
199 | <input type="text" class="form-control_ txt" name="price" placeholder="Цена" | ||
200 | required maxlength="100" style="width: 80%" value="{{ old('price') ?? $house->price ?? '' }}"><br><br> | ||
201 | |||
202 | <label for="price_m2">Цена за метр2: </label><br> | ||
203 | @error('price_m2') | ||
204 | <div class="alert alert-danger">{{ $message }}</div> | ||
205 | @enderror | ||
206 | <input type="text" class="form-control_ txt" name="price_m2" placeholder="Цена за метр2" | ||
207 | required maxlength="100" style="width: 80%" value="{{ old('price_m2') ?? $house->price_m2 ?? '' }}"><br><br> | ||
208 | |||
209 | <label for="rent_in_year">Аренда в год (поле только для аренды): </label><br> | ||
210 | @error('rent_in_year') | ||
211 | <div class="alert alert-danger">{{ $message }}</div> | ||
212 | @enderror | ||
213 | <input type="text" class="form-control_ txt" name="rent_in_year" placeholder="Аренда в год" | ||
214 | required maxlength="100" style="width: 80%" value="{{ old('rent_in_year') ?? $house->rent_in_year ?? '' }}"><br><br> | ||
215 | |||
216 | <label for="description_house">Описание офиса: </label><br> | ||
217 | @error('description_house') | ||
218 | <div class="alert alert-danger">{{ $message }}</div> | ||
219 | @enderror | ||
220 | <textarea class="form-control_ txtarea ckeditor" name="description_house" placeholder="Описание офиса" required | ||
221 | rows="10" style="width: 80%">{{ old('description_house') ?? $area->description_house ?? '' }}</textarea><br><br> | ||
222 | |||
223 | <label for="object_plan">План-объекта (картинка):</label><br> | ||
224 | <input type="file" class="form-control-file txt" name="object_plan" id="object_plan" accept="image/png, image/jpeg"> | ||
225 | |||
226 | @isset($house->object_plan) | ||
227 | <div class="form-group form-check"> | ||
228 | <img src="<?=asset(Storage::url($house->object_plan))?>" width="100px"/> | ||
229 | </div> | ||
230 | @endisset | ||
231 | <br><br> | ||
232 | |||
233 | <label for="floor_plan">План-этажа (картинка):</label><br> | ||
234 | <input type="file" class="form-control-file txt" name="floor_plan" id="floor_plan" accept="image/png, image/jpeg"> | ||
235 | |||
236 | @isset($house->floor_plan) | ||
237 | <div class="form-group form-check"> | ||
238 | <img src="<?=asset(Storage::url($house->floor_plan))?>" width="100px"/> | ||
239 | </div> | ||
240 | @endisset | ||
241 | <br><br> | ||
242 | |||
243 | <label for="present">Презентация:</label><br> | ||
244 | <input type="file" class="form-control-file txt" name="present" id="present"> | ||
245 | |||
246 | @isset($house->present) | ||
247 | <div class="form-group form-check"> | ||
248 | <a href="<?=asset(Storage::url($house->floor_plan))?>">Презентация</a> | ||
249 | </div> | ||
250 | @endisset | ||
251 | <br><br> | ||
252 | |||
253 | <label for="unloading_area">Зона разгрузки: </label><br> | ||
254 | @error('unloading_area') | ||
255 | <div class="alert alert-danger">{{ $message }}</div> | ||
256 | @enderror | ||
257 | <select name="unloading_area" id="unloading_area" class="form-control"> | ||
258 | <option value="1" | ||
259 | @isset($house) | ||
260 | @if($house->unloading_area == '1') | ||
261 | selected | ||
262 | @endif | ||
263 | @endisset | ||
264 | >Есть</option> | ||
265 | <option value="0" | ||
266 | @isset($house) | ||
267 | @if($house->unloading_area == '0') | ||
268 | selected | ||
269 | @endif | ||
270 | @endisset | ||
271 | >Нет</option> | ||
272 | </select><br><br> | ||
273 | |||
274 | <label for="electric_power">Электрическая мощность: </label><br> | ||
275 | @error('electric_power') | ||
276 | <div class="alert alert-danger">{{ $message }}</div> | ||
277 | @enderror | ||
278 | <input type="text" class="form-control_ txt" name="electric_power" placeholder="Электрическая мощность" | ||
279 | required maxlength="100" style="width: 80%" value="{{ old('electric_power') ?? $house->electric_power ?? '' }}"><br><br> | ||
280 | |||
281 | <label for="travel_card">Проездное место: </label><br> | ||
282 | @error('travel_card') | ||
283 | <div class="alert alert-danger">{{ $message }}</div> | ||
284 | @enderror | ||
285 | <select name="travel_card" id="travel_card" class="form-control"> | ||
286 | <option value="1" | ||
287 | @isset($house) | ||
288 | @if($house->travel_card == '1') | ||
289 | selected | ||
290 | @endif | ||
291 | @endisset | ||
292 | >Да</option> | ||
293 | <option value="0" | ||
294 | @isset($house) | ||
295 | @if($house->travel_card == '0') | ||
296 | selected | ||
297 | @endif | ||
298 | @endisset | ||
299 | >Нет</option> | ||
300 | </select><br><br> | ||
301 | |||
302 | <label for="passing_place">Проходное место: </label><br> | ||
303 | @error('passing_place') | ||
304 | <div class="alert alert-danger">{{ $message }}</div> | ||
305 | @enderror | ||
306 | <select name="passing_place" id="passing_place" class="form-control"> | ||
307 | <option value="1" | ||
308 | @isset($house) | ||
309 | @if($house->passing_place == '1') | ||
310 | selected | ||
311 | @endif | ||
312 | @endisset | ||
313 | >Да</option> | ||
314 | <option value="0" | ||
315 | @isset($house) | ||
316 | @if($house->passing_place == '0') | ||
317 | selected | ||
318 | @endif | ||
319 | @endisset | ||
320 | >Нет</option> | ||
321 | </select><br><br> | ||
322 | |||
323 | <label for="separate_input">Отдельный вход: </label><br> | ||
324 | @error('separate_input') | ||
325 | <div class="alert alert-danger">{{ $message }}</div> | ||
326 | @enderror | ||
327 | <select name="separate_input" id="separate_input" class="form-control"> | ||
328 | <option value="1" | ||
329 | @isset($house) | ||
330 | @if($house->separate_input == '1') | ||
331 | selected | ||
332 | @endif | ||
333 | @endisset | ||
334 | >Да</option> | ||
335 | <option value="0" | ||
336 | @isset($house) | ||
337 | @if($house->separate_input == '0') | ||
338 | selected | ||
339 | @endif | ||
340 | @endisset | ||
341 | >Нет</option> | ||
342 | </select><br><br> | ||
343 | |||
344 | <label for="shop_windows">Витрины: </label><br> | ||
345 | @error('shop_windows') | ||
346 | <div class="alert alert-danger">{{ $message }}</div> | ||
347 | @enderror | ||
348 | <select name="shop_windows" id="shop_windows" class="form-control"> | ||
349 | <option value="1" | ||
350 | @isset($house) | ||
351 | @if($house->shop_windows == '1') | ||
352 | selected | ||
353 | @endif | ||
354 | @endisset | ||
355 | >Да</option> | ||
356 | <option value="0" | ||
357 | @isset($house) | ||
358 | @if($house->shop_windows == '0') | ||
359 | selected | ||
360 | @endif | ||
361 | @endisset | ||
362 | >Нет</option> | ||
363 | </select><br><br> | ||
364 | |||
365 | <label for="place_advertising">Место для рекламы: </label><br> | ||
366 | @error('place_advertising') | ||
367 | <div class="alert alert-danger">{{ $message }}</div> | ||
368 | @enderror | ||
369 | <select name="place_advertising" id="place_advertising" class="form-control"> | ||
370 | <option value="1" | ||
371 | @isset($house) | ||
372 | @if($house->place_advertising == '1') | ||
373 | selected | ||
374 | @endif | ||
375 | @endisset | ||
376 | >Да</option> | ||
377 | <option value="0" | ||
378 | @isset($house) | ||
379 | @if($house->place_advertising == '0') | ||
380 | selected | ||
381 | @endif | ||
382 | @endisset | ||
383 | >Нет</option> | ||
384 | </select><br><br> | ||
385 | |||
386 | <label for="windows">Окна: </label><br> | ||
387 | @error('windows') | ||
388 | <div class="alert alert-danger">{{ $message }}</div> | ||
389 | @enderror | ||
390 | <input type="text" class="form-control_ txt" name="windows" placeholder="Окна" | ||
391 | required maxlength="100" style="width: 80%" value="{{ old('windows') ?? $house->windows ?? '' }}"><br><br> | ||
392 | |||
393 | <label for="hood">Вытяжка: </label><br> | ||
394 | @error('hood') | ||
395 | <div class="alert alert-danger">{{ $message }}</div> | ||
396 | @enderror | ||
397 | <select name="hood" id="hood" class="form-control"> | ||
398 | <option value="1" | ||
399 | @isset($house) | ||
400 | @if($house->hood == '1') | ||
401 | selected | ||
402 | @endif | ||
403 | @endisset | ||
404 | >Да</option> | ||
405 | <option value="0" | ||
406 | @isset($house) | ||
407 | @if($house->hood == '0') | ||
408 | selected | ||
409 | @endif | ||
410 | @endisset | ||
411 | >Нет</option> | ||
412 | </select><br><br> | ||
413 | |||
414 | <label for="central_heating">Центральное отопление: </label><br> | ||
415 | @error('central_heating') | ||
416 | <div class="alert alert-danger">{{ $message }}</div> | ||
417 | @enderror | ||
418 | <select name="central_heating" id="central_heating" class="form-control"> | ||
419 | <option value="1" | ||
420 | @isset($house) | ||
421 | @if($house->central_heating == '1') | ||
422 | selected | ||
423 | @endif | ||
424 | @endisset | ||
425 | >Да</option> | ||
426 | <option value="0" | ||
427 | @isset($house) | ||
428 | @if($house->central_heating == '0') | ||
429 | selected | ||
430 | @endif | ||
431 | @endisset | ||
432 | >Нет</option> | ||
433 | </select><br><br> | ||
434 | |||
435 | <label for="opening_hours">Возможные часы работы: </label><br> | ||
436 | @error('opening_hours') | ||
437 | <div class="alert alert-danger">{{ $message }}</div> | ||
438 | @enderror | ||
439 | <input type="text" class="form-control_ txt" name="opening_hours" placeholder="Возможные часы работы" | ||
440 | required maxlength="100" style="width: 80%" value="{{ old('opening_hours') ?? $house->opening_hours ?? '' }}"><br><br> | ||
441 | |||
442 | <label for="finishing">Отделка: </label><br> | ||
443 | @error('finishing') | ||
444 | <div class="alert alert-danger">{{ $message }}</div> | ||
445 | @enderror | ||
446 | <select name="finishing" id="finishing" class="form-control"> | ||
447 | <option value="1" | ||
448 | @isset($house) | ||
449 | @if($house->finishing == '1') | ||
450 | selected | ||
451 | @endif | ||
452 | @endisset | ||
453 | >Да</option> | ||
454 | <option value="0" | ||
455 | @isset($house) | ||
456 | @if($house->finishing == '0') | ||
457 | selected | ||
458 | @endif | ||
459 | @endisset | ||
460 | >Нет</option> | ||
461 | </select><br><br> | ||
462 | |||
463 | <label for="parking">Парковка (кол-во мест): </label><br> | ||
464 | @error('parking') | ||
465 | <div class="alert alert-danger">{{ $message }}</div> | ||
466 | @enderror | ||
467 | <input type="text" class="form-control_ txt" name="parking" placeholder="Парковка" | ||
468 | required maxlength="100" style="width: 80%" value="{{ old('parking') ?? $house->parking ?? '' }}"><br><br> | ||
469 | |||
470 | <label for="scheme_deal">Схема сделки: </label><br> | ||
471 | @error('scheme_deal') | ||
472 | <div class="alert alert-danger">{{ $message }}</div> | ||
473 | @enderror | ||
474 | <input type="text" class="form-control_ txt" name="scheme_deal" placeholder="Схема сделки" | ||
475 | required maxlength="100" style="width: 80%" value="{{ old('scheme_deal') ?? $house->scheme_deal ?? '' }}"><br><br> | ||
476 | |||
477 | <label for="map_coord">Координаты дома: </label><br> | ||
478 | <input type="text" class="form-control_ txt" name="map_coord" placeholder="Координаты дома" | ||
479 | required maxlength="100" value="{{ old('map_coord') ?? $house->map_coord ?? '' }}"><br><br> | ||
480 | |||
481 | <label for="sos_obj">Состояние объекта: </label><br> | ||
482 | @error('sos_obj') | ||
483 | <div class="alert alert-danger">{{ $message }}</div> | ||
484 | @enderror | ||
485 | <select name="sos_obj" id="sos_obj" class="form-control"> | ||
486 | <option value="Рабочее" | ||
487 | @isset($house) | ||
488 | @if($house->sos_obj == 'Рабочее') | ||
489 | selected | ||
490 | @endif | ||
491 | @endisset | ||
492 | >Рабочее</option> | ||
493 | <option value="Не рабочее" | ||
494 | @isset($house) | ||
495 | @if($house->sos_obj == 'Не рабочее') | ||
496 | selected | ||
497 | @endif | ||
498 | @endisset | ||
499 | >Не рабочее</option> | ||
500 | </select><br><br> | ||
501 | |||
502 | <label for="type_plan">Тип планировки: </label><br> | ||
503 | @error('type_plan') | ||
504 | <div class="alert alert-danger">{{ $message }}</div> | ||
505 | @enderror | ||
506 | <select name="type_plan" id="type_plan" class="form-control"> | ||
507 | <option value="Открытая" | ||
508 | @isset($house) | ||
509 | @if($house->type_plan == 'Открытая') | ||
510 | selected | ||
511 | @endif | ||
512 | @endisset | ||
513 | >Открытая</option> | ||
514 | <option value="Закрытая" | ||
515 | @isset($house) | ||
516 | @if($house->type_plan == 'Закрытая') | ||
517 | selected | ||
518 | @endif | ||
519 | @endisset | ||
520 | >Закрытая</option> | ||
521 | </select><br><br> | ||
522 | |||
523 | <label for="description_2">Описание офиса дополнительно: </label><br> | ||
524 | @error('description_2') | ||
525 | <div class="alert alert-danger">{{ $message }}</div> | ||
526 | @enderror | ||
527 | <textarea class="form-control_ txtarea ckeditor" name="description_2" placeholder="Описание офиса дополнительно" required | ||
528 | rows="10" style="width: 80%">{{ old('description_2') ?? $house->description_2 ?? '' }}</textarea><br><br> | ||
529 | |||
530 | <br> | ||
531 | <button type="submit" class="btn hero-search__btn btn--main">Сохранить</button> | ||
532 | |||
533 | |||
534 |
resources/views/admin/houses/index.blade.php
1 | @extends('layout.admin', ['title' => 'Офисы']) | 1 | @extends('layout.admin', ['title' => 'Офисы']) |
2 | 2 | ||
3 | @section('content') | 3 | @section('content') |
4 | <section class="favorites"> | 4 | <section class="favorites"> |
5 | <div class="favorites-top"> | 5 | <div class="favorites-top"> |
6 | <div class="container"> | 6 | <div class="container"> |
7 | <div class="breadcrumbs"> | 7 | <div class="breadcrumbs"> |
8 | <ul class="breadcrumbs__list"> | 8 | <ul class="breadcrumbs__list"> |
9 | <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('user.index') }}">Главная</a></li> | 9 | <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('user.index') }}">Главная</a></li> |
10 | <li class="breadcrumbs__item"><span class="breadcrumbs__link">Офисы </span></li> | 10 | <li class="breadcrumbs__item"><span class="breadcrumbs__link">Офисы </span></li> |
11 | </ul> | 11 | </ul> |
12 | </div> | 12 | </div> |
13 | <h1 class="favorites__title title-main">Офисы</h1> | 13 | <h1 class="favorites__title title-main">Офисы</h1> |
14 | </div> | 14 | </div> |
15 | </div> | 15 | </div> |
16 | <div class="favorites-cnt"> | 16 | <div class="favorites-cnt"> |
17 | <div class="container"> | 17 | <div class="container"> |
18 | <a href="{{ route('admin.houses.create') }}" class="btn hero-search__btn btn--main"> | 18 | <a href="{{ route('admin.houses.create') }}" class="btn hero-search__btn btn--main"> |
19 | Создать офис | 19 | Создать офис |
20 | </a><br><br> | 20 | </a><br><br> |
21 | <table class="table" style="width: 100%"> | 21 | <table class="table" style="width: 100%"> |
22 | <thead> | 22 | <thead> |
23 | <tr> | 23 | <tr> |
24 | <th>Фото</th> | 24 | <th>Фото</th> |
25 | <th>ID</th> | 25 | <th>ID</th> |
26 | <th>Название офиса</th> | 26 | <th>Название офиса</th> |
27 | <th>Жилой комплекс</th> | 27 | <th>Жилой комплекс</th> |
28 | <th>Адрес</th> | 28 | <th>Адрес</th> |
29 | <th>Дата создания</th> | 29 | <th>Дата создания</th> |
30 | <th>Действия</th> | 30 | <th>Действия</th> |
31 | </tr> | 31 | </tr> |
32 | </thead> | 32 | </thead> |
33 | <tbody> | 33 | <tbody> |
34 | @if ($houses->count()) | 34 | @if ($houses->count()) |
35 | @foreach($houses as $house) | 35 | @foreach($houses as $house) |
36 | <tr> | 36 | <tr> |
37 | <td><? if (empty($house->foto_main)) {?>Нет фото<?} else {?><img src="<?=asset(Storage::url($house->foto_main))?>" width="100px"/><?}?></td> | 37 | <td><? if (empty($house->foto_main)) {?>Нет фото<?} else {?><img src="<?=asset(Storage::url($house->foto_main))?>" width="100px"/><?}?></td> |
38 | <td>{{ $house->id }}</td> | 38 | <td>{{ $house->id }}</td> |
39 | <td>{{ $house->title }}</td> | 39 | <td>{{ $house->title }}</td> |
40 | <td>{{ $house->areas->name_area }}</td> | 40 | <td>{{ $house->areas->name_area }}</td> |
41 | <td>{{ $house->address }}</td> | 41 | <td>{{ $house->address }}</td> |
42 | <td>{{ $house->created_at }}</td> | 42 | <td>{{ $house->created_at }}</td> |
43 | <td> <form action="{{ route('admin.houses.destroy', $house) }}" method="POST"> | 43 | <td> <form action="{{ route('admin.houses.destroy', $house) }}" method="POST"> |
44 | <a style="color:green" target="_blank" href="{{ route('offer', ['house' => $house->id]) }}"> | 44 | <a style="color:green" target="_blank" href="{{ route('offer', ['house' => $house->id]) }}"> |
45 | Просмотр | 45 | Просмотр |
46 | </a> | | 46 | </a> | |
47 | <a href="{{ route('admin.houses.edit', ['house' => $house->id]) }}"> | 47 | <a href="{{ route('admin.houses.edit', ['house' => $house->id]) }}"> |
48 | Редактировать | 48 | Редактировать |
49 | </a> | | 49 | </a> | |
50 | <a href="{{ route('admin.view.images.houses', ['house' => $house->id]) }}"> | ||
51 | Доп.картинки | ||
52 | </a> | | ||
53 | |||
50 | @csrf | 54 | @csrf |
51 | @method('DELETE') | 55 | @method('DELETE') |
52 | <input class=" btn-danger" type="submit" value="Удалить"> | 56 | <input class=" btn-danger" type="submit" value="Удалить"> |
53 | </form> | 57 | </form> |
54 | </td> | 58 | </td> |
55 | </tr> | 59 | </tr> |
56 | @endforeach | 60 | @endforeach |
57 | @else | 61 | @else |
58 | <tr> | 62 | <tr> |
59 | <td>-</td> | 63 | <td>-</td> |
60 | <td>-</td> | 64 | <td>-</td> |
61 | <td>-</td> | 65 | <td>-</td> |
62 | <td>-</td> | 66 | <td>-</td> |
63 | <td>-</td> | 67 | <td>-</td> |
64 | <td>-</td> | 68 | <td>-</td> |
65 | <td>-</td> | 69 | <td>-</td> |
66 | </tr> | 70 | </tr> |
67 | @endif | 71 | @endif |
68 | 72 | ||
69 | </tbody> | 73 | </tbody> |
70 | </table> | 74 | </table> |
71 | {{ $houses->onEachSide(1)->links('catalogs.paginate') }} | 75 | {{ $houses->onEachSide(1)->links('catalogs.paginate') }} |
72 | <div class="favorites__items"> | 76 | <div class="favorites__items"> |
73 | 77 | ||
74 | </div> | 78 | </div> |
75 | </div> | 79 | </div> |
76 | </div> | 80 | </div> |
77 | </section> | 81 | </section> |
78 | @endsection | 82 | @endsection |
79 | 83 |
resources/views/admin/houses/view_img.blade.php
File was created | 1 | @extends('layout.admin', ['title' => 'Дополнительные картинки офиса']) | |
2 | |||
3 | @section('content') | ||
4 | <section class="favorites"> | ||
5 | <div class="favorites-top"> | ||
6 | <div class="container"> | ||
7 | <div class="breadcrumbs"> | ||
8 | <ul class="breadcrumbs__list"> | ||
9 | <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('user.index') }}">Главная</a></li> | ||
10 | <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('admin.houses.index') }}">Офисы </a></li> | ||
11 | <li class="breadcrumbs__item"><span class="breadcrumbs__link">Дополнительные картинки офиса </span></li> | ||
12 | </ul> | ||
13 | </div> | ||
14 | <h1 class="favorites__title title-main">Дополнительные картинки офиса</h1> | ||
15 | </div> | ||
16 | </div> | ||
17 | <div class="favorites-cnt"> | ||
18 | <div class="container"> | ||
19 | <h3>ID: {{$house->id}} Название офиса: {{$house->title}}</h3><br><br> | ||
20 | <h3>Дополнительные картинки</h3><br> | ||
21 | <a class="btn hero-search__btn btn--main" href="{{ route ('admin.add.images.houses', ['house' => $house->id]) }}">Добавить картинку в галерею</a><br><br> | ||
22 | |||
23 | <table class="table" style="width: 100%"> | ||
24 | <thead> | ||
25 | <tr> | ||
26 | <th>ID</th> | ||
27 | <th>Фото</th> | ||
28 | <th>Действия</th> | ||
29 | </tr> | ||
30 | </thead> | ||
31 | <tbody> | ||
32 | @if ($house->fotohouse->count()) | ||
33 | @foreach($house->fotohouse as $img) | ||
34 | <tr> | ||
35 | <td><?=$img->id?></td> | ||
36 | <td><img src="<?=asset(Storage::url($img->foto))?>" width="100px"/></td> | ||
37 | <td><a href="{{ route('admin.del.images.houses', ['id'=> $img->id, 'house' => $house->id]) }}">Удалить</a></td> | ||
38 | </tr> | ||
39 | @endforeach | ||
40 | @else | ||
41 | <tr> | ||
42 | <td>-</td> | ||
43 | <td>-</td> | ||
44 | <td>-</td> | ||
45 | </tr> | ||
46 | @endif | ||
47 | </tbody> | ||
48 | </table> | ||
49 | </div> | ||
50 | </div> | ||
51 | </section> | ||
52 | @endsection | ||
53 | |||
54 |
routes/web.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Illuminate\Support\Facades\Auth; | 3 | use Illuminate\Support\Facades\Auth; |
4 | use Illuminate\Support\Facades\Route; | 4 | use Illuminate\Support\Facades\Route; |
5 | use App\Http\Controllers\MainController; | 5 | use App\Http\Controllers\MainController; |
6 | use App\Http\Controllers\RegisterController; | 6 | use App\Http\Controllers\RegisterController; |
7 | use App\Http\Controllers\LoginController; | 7 | use App\Http\Controllers\LoginController; |
8 | use App\Http\Controllers\AdminController; | 8 | use App\Http\Controllers\AdminController; |
9 | use App\Http\Controllers\Admin\AreaController; | 9 | use App\Http\Controllers\Admin\AreaController; |
10 | use App\Http\Controllers\Admin\NewsController; | 10 | use App\Http\Controllers\Admin\NewsController; |
11 | use App\Http\Controllers\Admin\CompanyAreaController; | 11 | use App\Http\Controllers\Admin\CompanyAreaController; |
12 | use App\Http\Controllers\Admin\FormatAreaController; | 12 | use App\Http\Controllers\Admin\FormatAreaController; |
13 | use App\Http\Controllers\Admin\TypeAreaController; | 13 | use App\Http\Controllers\Admin\TypeAreaController; |
14 | use App\Http\Controllers\Admin\HousesController; | 14 | use App\Http\Controllers\Admin\HousesController; |
15 | use App\Http\Controllers\Admin\MessageAreaController; | 15 | use App\Http\Controllers\Admin\MessageAreaController; |
16 | 16 | ||
17 | /* | 17 | /* |
18 | |-------------------------------------------------------------------------- | 18 | |-------------------------------------------------------------------------- |
19 | | Web Routes | 19 | | Web Routes |
20 | |-------------------------------------------------------------------------- | 20 | |-------------------------------------------------------------------------- |
21 | | | 21 | | |
22 | | Here is where you can register web routes for your application. These | 22 | | Here is where you can register web routes for your application. These |
23 | | routes are loaded by the RouteServiceProvider within a group which | 23 | | routes are loaded by the RouteServiceProvider within a group which |
24 | | contains the "web" middleware group. Now create something great! | 24 | | contains the "web" middleware group. Now create something great! |
25 | | | 25 | | |
26 | */ | 26 | */ |
27 | 27 | ||
28 | //Главная страница | 28 | //Главная страница |
29 | Route::get('/',[MainController::class, 'index'])->name('index'); | 29 | Route::get('/',[MainController::class, 'index'])->name('index'); |
30 | 30 | ||
31 | //Страница Избранные | 31 | //Страница Избранные |
32 | Route::get('favorite',[MainController::class, 'favorite'])->name('favorite'); | 32 | Route::get('favorite',[MainController::class, 'favorite'])->name('favorite'); |
33 | 33 | ||
34 | //Страница контакты | 34 | //Страница контакты |
35 | Route::get('contact',[MainController::class, 'contact'])->name('contact'); | 35 | Route::get('contact',[MainController::class, 'contact'])->name('contact'); |
36 | 36 | ||
37 | //Страница каталог | 37 | //Страница каталог |
38 | Route::get('catalog',[MainController::class, 'catalog'])->name('catalog'); | 38 | Route::get('catalog',[MainController::class, 'catalog'])->name('catalog'); |
39 | 39 | ||
40 | //Страница новости | 40 | //Страница новости |
41 | Route::get('news',[MainController::class, 'news'])->name('news'); | 41 | Route::get('news',[MainController::class, 'news'])->name('news'); |
42 | 42 | ||
43 | //Страница о компании | 43 | //Страница о компании |
44 | Route::get('about',[MainController::class, 'about'])->name('about'); | 44 | Route::get('about',[MainController::class, 'about'])->name('about'); |
45 | 45 | ||
46 | //Страница объекты на карте | 46 | //Страница объекты на карте |
47 | Route::get('maps',[MainController::class, 'mapsobj'])->name('maps'); | 47 | Route::get('maps',[MainController::class, 'mapsobj'])->name('maps'); |
48 | 48 | ||
49 | // Политика конфедициальности | 49 | // Политика конфедициальности |
50 | Route::get('conf', function () { | 50 | Route::get('conf', function () { |
51 | return view('conf'); | 51 | return view('conf'); |
52 | })->name('conf'); | 52 | })->name('conf'); |
53 | 53 | ||
54 | //Детальная страница предложения недвижимости | 54 | //Детальная страница предложения недвижимости |
55 | Route::get('offer/{house:id}', [MainController::class, 'offer'])->name('offer'); | 55 | Route::get('offer/{house:id}', [MainController::class, 'offer'])->name('offer'); |
56 | 56 | ||
57 | //Детальная страница новостей | 57 | //Детальная страница новостей |
58 | Route::get('detail-new/{news:id}', [MainController::class, 'DetailNew'])->name('new'); | 58 | Route::get('detail-new/{news:id}', [MainController::class, 'DetailNew'])->name('new'); |
59 | 59 | ||
60 | //Страница ЖилойКомплекс | 60 | //Страница ЖилойКомплекс |
61 | Route::get('complex/{area:id}', [MainController::class, 'complex'])->name('complex'); | 61 | Route::get('complex/{area:id}', [MainController::class, 'complex'])->name('complex'); |
62 | 62 | ||
63 | // ajax-фильтры каталога | 63 | // ajax-фильтры каталога |
64 | Route::get('catalog_ajax_filter', [MainController::class, 'catalog_ajax_filter'])->name('catalog_ajax_filter'); | 64 | Route::get('catalog_ajax_filter', [MainController::class, 'catalog_ajax_filter'])->name('catalog_ajax_filter'); |
65 | 65 | ||
66 | //Категория | 66 | //Категория |
67 | Route::get('category/{cat}', [MainController::class, 'Category'])->name('category'); | 67 | Route::get('category/{cat}', [MainController::class, 'Category'])->name('category'); |
68 | 68 | ||
69 | //Категория ajax | 69 | //Категория ajax |
70 | Route::get('category_ajax/{cat}', [MainController::class, 'category_ajax'])->name('category_ajax'); | 70 | Route::get('category_ajax/{cat}', [MainController::class, 'category_ajax'])->name('category_ajax'); |
71 | 71 | ||
72 | //Страница куков | 72 | //Страница куков |
73 | Route::get('cookies', function () { | 73 | Route::get('cookies', function () { |
74 | return view('cookies'); | 74 | return view('cookies'); |
75 | })->name('cookies'); | 75 | })->name('cookies'); |
76 | 76 | ||
77 | //Форма обратной связи в футере | 77 | //Форма обратной связи в футере |
78 | Route::post('main_form', [MainController::class, 'main_form'])->name('main_form'); | 78 | Route::post('main_form', [MainController::class, 'main_form'])->name('main_form'); |
79 | 79 | ||
80 | //Форма обратной связи в хедере | 80 | //Форма обратной связи в хедере |
81 | Route::post('header_form', [MainController::class, 'header_form'])->name('header_form'); | 81 | Route::post('header_form', [MainController::class, 'header_form'])->name('header_form'); |
82 | 82 | ||
83 | //Форма записаться на просмотр в карточке офиса | 83 | //Форма записаться на просмотр в карточке офиса |
84 | Route::post('rec_view_form', [MainController::class, 'rec_view_form'])->name('rec_view_form'); | 84 | Route::post('rec_view_form', [MainController::class, 'rec_view_form'])->name('rec_view_form'); |
85 | 85 | ||
86 | //Форма обратной связи на странице контакты | 86 | //Форма обратной связи на странице контакты |
87 | Route::post('page_contact_form', [MainController::class, 'page_contact_form'])->name('page_contact_form'); | 87 | Route::post('page_contact_form', [MainController::class, 'page_contact_form'])->name('page_contact_form'); |
88 | 88 | ||
89 | //Форма обратной связи предложения по почте | 89 | //Форма обратной связи предложения по почте |
90 | Route::post('email_form', [MainController::class, 'email_form'])->name('email_form'); | 90 | Route::post('email_form', [MainController::class, 'email_form'])->name('email_form'); |
91 | 91 | ||
92 | Route::group([ | 92 | Route::group([ |
93 | 'as' => 'auth.', // имя маршрута, например auth.index | 93 | 'as' => 'auth.', // имя маршрута, например auth.index |
94 | 'prefix' => 'auth', // префикс маршрута, например auth/index | 94 | 'prefix' => 'auth', // префикс маршрута, например auth/index |
95 | ], function () { | 95 | ], function () { |
96 | // Форма регистрации | 96 | // Форма регистрации |
97 | Route::get('register', [RegisterController::class, 'register'])->name('register'); | 97 | Route::get('register', [RegisterController::class, 'register'])->name('register'); |
98 | 98 | ||
99 | // Создание пользователя | 99 | // Создание пользователя |
100 | Route::post('register', [RegisterController::class, 'create'])->name('create'); | 100 | Route::post('register', [RegisterController::class, 'create'])->name('create'); |
101 | //Форма входа | 101 | //Форма входа |
102 | Route::get('login', [LoginController::class, 'login'])->name('login'); | 102 | Route::get('login', [LoginController::class, 'login'])->name('login'); |
103 | 103 | ||
104 | // аутентификация | 104 | // аутентификация |
105 | Route::post('login', [LoginController::class, 'autenticate'])->name('auth'); | 105 | Route::post('login', [LoginController::class, 'autenticate'])->name('auth'); |
106 | 106 | ||
107 | // выход | 107 | // выход |
108 | Route::get('logout', [LoginController::class, 'logout'])->name('logout'); | 108 | Route::get('logout', [LoginController::class, 'logout'])->name('logout'); |
109 | 109 | ||
110 | //Страница неудачной авторизации | 110 | //Страница неудачной авторизации |
111 | Route::get('vefiry-message', function () { | 111 | Route::get('vefiry-message', function () { |
112 | return view('auth.vefiry-message'); | 112 | return view('auth.vefiry-message'); |
113 | })->name('vefiry-message'); | 113 | })->name('vefiry-message'); |
114 | 114 | ||
115 | }); | 115 | }); |
116 | 116 | ||
117 | /* | 117 | /* |
118 | * Личный кабинет пользователя | 118 | * Личный кабинет пользователя |
119 | */ | 119 | */ |
120 | Route::group([ | 120 | Route::group([ |
121 | 'as' => 'user.', // имя маршрута, например user.index | 121 | 'as' => 'user.', // имя маршрута, например user.index |
122 | 'prefix' => 'user', // префикс маршрута, например user/index | 122 | 'prefix' => 'user', // префикс маршрута, например user/index |
123 | //'namespace' => 'User', // пространство имен контроллеров | 123 | //'namespace' => 'User', // пространство имен контроллеров |
124 | 'middleware' => ['auth'] // один или несколько посредников | 124 | 'middleware' => ['auth'] // один или несколько посредников |
125 | ], function () { | 125 | ], function () { |
126 | // главная страница | 126 | // главная страница |
127 | Route::get('index', [AdminController::class, 'index'])->name('index'); | 127 | Route::get('index', [AdminController::class, 'index'])->name('index'); |
128 | }); | 128 | }); |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * Панель управления: CRUD-операции над постами, категориями, тегами | 131 | * Панель управления: CRUD-операции над постами, категориями, тегами |
132 | */ | 132 | */ |
133 | Route::group([ | 133 | Route::group([ |
134 | 'as' => 'admin.', // имя маршрута, например admin.index | 134 | 'as' => 'admin.', // имя маршрута, например admin.index |
135 | 'prefix' => 'admin', // префикс маршрута, например admin/index | 135 | 'prefix' => 'admin', // префикс маршрута, например admin/index |
136 | //'namespace' => 'Admin', // пространство имен контроллеров | 136 | //'namespace' => 'Admin', // пространство имен контроллеров |
137 | 'middleware' => ['auth'] // один или несколько посредников | 137 | 'middleware' => ['auth'] // один или несколько посредников |
138 | ], function () { | 138 | ], function () { |
139 | /* | 139 | /* |
140 | * CRUD-операции над постами Жилых комплексов | 140 | * CRUD-операции над постами Жилых комплексов |
141 | */ | 141 | */ |
142 | Route::resource('area', AreaController::class, []); | 142 | Route::resource('area', AreaController::class, []); |
143 | 143 | ||
144 | //дополнительный маршрут для показа картинок объектов недвижимости | 144 | //дополнительный маршрут для показа картинок объектов недвижимости |
145 | Route::get('img/area/{area}', [AreaController::class, 'area_category']) | 145 | Route::get('img/area/{area}', [AreaController::class, 'area_category']) |
146 | ->name('img.area'); | 146 | ->name('img.area'); |
147 | 147 | ||
148 | //дополнительный маршрут для добавления картинок объектов недвижимости | 148 | //дополнительный маршрут для добавления картинок объектов недвижимости |
149 | Route::post('img/area/{area}', [AreaController::class, 'area_add_img']) | 149 | Route::post('img/area/{area}', [AreaController::class, 'area_add_img']) |
150 | ->name('img.add.area'); | 150 | ->name('img.add.area'); |
151 | 151 | ||
152 | //дополнительный маршрут для удаления картинок объектов недвжимости | 152 | //дополнительный маршрут для удаления картинок объектов недвжимости |
153 | Route::get('img/del/{id}/area/{area}', [AreaController::class, 'area_del_img']) | 153 | Route::get('img/del/{id}/area/{area}', [AreaController::class, 'area_del_img']) |
154 | ->name('img.del.area'); | 154 | ->name('img.del.area'); |
155 | 155 | ||
156 | /* | 156 | /* |
157 | * CRUD-операции над постами Новости | 157 | * CRUD-операции над постами Новости |
158 | */ | 158 | */ |
159 | Route::resource('news', NewsController::class, []); | 159 | Route::resource('news', NewsController::class, []); |
160 | 160 | ||
161 | /* | 161 | /* |
162 | * CRUD-операции над настройками Компании | 162 | * CRUD-операции над настройками Компании |
163 | */ | 163 | */ |
164 | Route::resource('company', CompanyAreaController::class, ['except' => ['create', 'store', 'destroy', 'index']]); | 164 | Route::resource('company', CompanyAreaController::class, ['except' => ['create', 'store', 'destroy', 'index']]); |
165 | 165 | ||
166 | //форма добавление партнера | 166 | //форма добавление партнера |
167 | Route::get('add/partner', [CompanyAreaController::class, 'add_partner'])->name('add.partner'); | 167 | Route::get('add/partner', [CompanyAreaController::class, 'add_partner'])->name('add.partner'); |
168 | 168 | ||
169 | //Добавление партнера | 169 | //Добавление партнера |
170 | Route::post('add/partner', [CompanyAreaController::class, 'add_partner_post'])->name('add.partner.post'); | 170 | Route::post('add/partner', [CompanyAreaController::class, 'add_partner_post'])->name('add.partner.post'); |
171 | 171 | ||
172 | //удаление партнера | 172 | //удаление партнера |
173 | Route::get('delete/partner/{partner}', [CompanyAreaController::class, 'delete_partner'])->name('delete.partner'); | 173 | Route::get('delete/partner/{partner}', [CompanyAreaController::class, 'delete_partner'])->name('delete.partner'); |
174 | 174 | ||
175 | 175 | ||
176 | /* | 176 | /* |
177 | * CRUD-операции над типами недвижимостью | 177 | * CRUD-операции над типами недвижимостью |
178 | */ | 178 | */ |
179 | Route::resource('typearea', TypeAreaController::class, ['except' => ['show']]); | 179 | Route::resource('typearea', TypeAreaController::class, ['except' => ['show']]); |
180 | 180 | ||
181 | /* | 181 | /* |
182 | * CRUD-операции над форматами недвижимостью | 182 | * CRUD-операции над форматами недвижимостью |
183 | */ | 183 | */ |
184 | Route::resource('formatarea', FormatAreaController::class, ['except' => ['show']]); | 184 | Route::resource('formatarea', FormatAreaController::class, ['except' => ['show']]); |
185 | 185 | ||
186 | /* | 186 | /* |
187 | * CRUD-операции над сообщениями сайта | 187 | * CRUD-операции над сообщениями сайта |
188 | */ | 188 | */ |
189 | Route::resource('message', MessageAreaController::class, ['except' => ['create', 'store', 'edit', 'update']]); | 189 | Route::resource('message', MessageAreaController::class, ['except' => ['create', 'store', 'edit', 'update']]); |
190 | 190 | ||
191 | /* | 191 | /* |
192 | * CRUD-операции над офисами | 192 | * CRUD-операции над офисами |
193 | */ | 193 | */ |
194 | Route::resource('houses', HousesController::class, ['except' => ['show']]); | 194 | Route::resource('houses', HousesController::class, ['except' => ['show']]); |
195 | 195 | ||
196 | // просмотр дополнительных картинок офиса | ||
197 | Route::get('houses/{house}/images', [HousesController::class, 'view_images'])->name('view.images.houses'); | ||
198 | |||
199 | // форма добавление дополнительной картинки офиса | ||
200 | Route::get('houses/{house}/add/images', [HousesController::class, 'add_images'])->name('add.images.houses'); | ||
201 | |||
202 | // добавление дополнительной картинки офиса | ||
203 | Route::post('houses/{house}/add/images', [HousesController::class, 'add_images_store'])->name('add.image.post.houses'); | ||
204 | |||
205 | // удаление дополнительной картинки офиса | ||
206 | Route::get('houses/{house}/del/{id}/images', [HousesController::class, 'del_images'])->name('del.images.houses'); | ||
207 | |||
196 | }); | 208 | }); |
197 | 209 |