Commit d82a28f22a6edc5619d174c3442426bc8c459bea

Authored by Андрей Ларионов
1 parent ad1c26f2fb
Exists in master

Админка форматы и типы недвижимости, компания, офисы

Showing 27 changed files with 762 additions and 45 deletions Side-by-side Diff

app/Http/Controllers/Admin/CompanyAreaController.php
... ... @@ -4,7 +4,10 @@ namespace App\Http\Controllers\Admin;
4 4  
5 5 use App\Http\Controllers\Controller;
6 6 use App\Models\Contact;
  7 +use App\Models\Partners;
7 8 use Illuminate\Http\Request;
  9 +use Illuminate\Support\Facades\Session;
  10 +use Illuminate\Support\Facades\Storage;
8 11 use Illuminate\Support\Facades\Validator;
9 12  
10 13 class CompanyAreaController extends Controller
... ... @@ -49,7 +52,8 @@ class CompanyAreaController extends Controller
49 52 public function show(Contact $contact)
50 53 {
51 54 $firm_data = Contact::find(1);
52   - return view('admin.company.view', compact('firm_data'));
  55 + $partners = Partners::query()->get();
  56 + return view('admin.company.view', compact('firm_data', 'partners'));
53 57 }
54 58  
55 59 /**
... ... @@ -104,4 +108,50 @@ class CompanyAreaController extends Controller
104 108 {
105 109 //
106 110 }
  111 +
  112 + /**
  113 + * Добавление партнера
  114 + */
  115 + public function add_partner() {
  116 + return view('admin.company.add_partner');
  117 + }
  118 +
  119 + /**
  120 + * Сохранение нового партнера
  121 + */
  122 + public function add_partner_post(Request $request) {
  123 + $rules = [
  124 + 'name' => 'required|min:3|max:255',
  125 + 'foto' => 'required|min:3|max:255',
  126 + ];
  127 + $messages = [
  128 + 'required' => 'Укажите обязательное поле',
  129 + ];
  130 +
  131 + $validator = Validator::make($request->all(), $rules, $messages);
  132 +
  133 + if ($validator->fails()) {
  134 + return redirect()->route('admin.add.partner')
  135 + ->withErrors($validator);
  136 + } else {
  137 + //$params = $request->all();
  138 + $partner = new Partners();
  139 + $partner->name = $request->name;
  140 + $partner->foto = $request->file('foto')->store('partners', 'public');
  141 + $partner->save();
  142 +
  143 + return redirect()->route('admin.company.show', ['company' => 1]);
  144 + }
  145 + }
  146 +
  147 + /**
  148 + * Удаление партнера
  149 + */
  150 + public function delete_partner(Partners $partner) {
  151 + Storage::delete($partner->foto);
  152 + $partner->delete();
  153 + Session::flash('message','Партнер был успешно удален!');
  154 +
  155 + return redirect()->route('admin.company.show', ['company' => 1]);
  156 + }
107 157 }
app/Http/Controllers/Admin/FormatAreaController.php
... ... @@ -4,7 +4,9 @@ namespace App\Http\Controllers\Admin;
4 4  
5 5 use App\Http\Controllers\Controller;
6 6 use App\Models\format_area;
  7 +use App\Models\type_area;
7 8 use Illuminate\Http\Request;
  9 +use Illuminate\Support\Facades\Validator;
8 10  
9 11 class FormatAreaController extends Controller
10 12 {
... ... @@ -15,7 +17,9 @@ class FormatAreaController extends Controller
15 17 */
16 18 public function index()
17 19 {
18   - //
  20 + $formatareas = format_area::query()->orderByDesc('created_at')->orderByDesc('id')->paginate(5);
  21 + return view('admin.formatarea.index', compact('formatareas'));
  22 +
19 23 }
20 24  
21 25 /**
... ... @@ -25,7 +29,7 @@ class FormatAreaController extends Controller
25 29 */
26 30 public function create()
27 31 {
28   - //
  32 + return view('admin.formatarea.create');
29 33 }
30 34  
31 35 /**
... ... @@ -36,7 +40,23 @@ class FormatAreaController extends Controller
36 40 */
37 41 public function store(Request $request)
38 42 {
39   - //
  43 + $rules = [
  44 + 'name_format' => 'required|min:3|max:255',
  45 + ];
  46 + $messages = [
  47 + 'required' => 'Укажите обязательное поле',
  48 + ];
  49 +
  50 + $validator = Validator::make($request->all(), $rules, $messages);
  51 +
  52 + if ($validator->fails()) {
  53 + return redirect()->route('admin.formatarea.create')
  54 + ->withErrors($validator);
  55 + } else {
  56 + $params = $request->all();
  57 + format_area::create($params);
  58 + return redirect()->route('admin.formatarea.index');
  59 + }
40 60 }
41 61  
42 62 /**
... ... @@ -53,34 +73,51 @@ class FormatAreaController extends Controller
53 73 /**
54 74 * Show the form for editing the specified resource.
55 75 *
56   - * @param \App\Models\format_area $format_area
  76 + * @param \App\Models\format_area $formatarea
57 77 * @return \Illuminate\Http\Response
58 78 */
59   - public function edit(format_area $format_area)
  79 + public function edit(format_area $formatarea)
60 80 {
61   - //
  81 + return view('admin.formatarea.edit', compact('formatarea'));
62 82 }
63 83  
64 84 /**
65 85 * Update the specified resource in storage.
66 86 *
67 87 * @param \Illuminate\Http\Request $request
68   - * @param \App\Models\format_area $format_area
  88 + * @param \App\Models\format_area $formatarea
69 89 * @return \Illuminate\Http\Response
70 90 */
71   - public function update(Request $request, format_area $format_area)
  91 + public function update(Request $request, format_area $formatarea)
72 92 {
73   - //
  93 + $rules = [
  94 + 'name_format' => 'required|min:3|max:255',
  95 + ];
  96 + $messages = [
  97 + 'required' => 'Укажите обязательное поле',
  98 + ];
  99 +
  100 + $validator = Validator::make($request->all(), $rules, $messages);
  101 +
  102 + if ($validator->fails()) {
  103 + return redirect()->route('admin.formatarea.edit')
  104 + ->withErrors($validator);
  105 + } else {
  106 + $params = $request->all();
  107 + $formatarea->update($params);
  108 + return redirect()->route('admin.formatarea.index');
  109 + }
74 110 }
75 111  
76 112 /**
77 113 * Remove the specified resource from storage.
78 114 *
79   - * @param \App\Models\format_area $format_area
  115 + * @param \App\Models\format_area $formatarea
80 116 * @return \Illuminate\Http\Response
81 117 */
82   - public function destroy(format_area $format_area)
  118 + public function destroy(format_area $formatarea)
83 119 {
84   - //
  120 + $formatarea->delete();
  121 + return redirect()->route('admin.formatarea.index');
85 122 }
86 123 }
app/Http/Controllers/Admin/HousesController.php
... ... @@ -3,6 +3,7 @@
3 3 namespace App\Http\Controllers\Admin;
4 4  
5 5 use App\Http\Controllers\Controller;
  6 +use App\Http\Requests\HousesRequest;
6 7 use App\Models\House;
7 8 use Illuminate\Http\Request;
8 9  
... ... @@ -15,7 +16,9 @@ class HousesController extends Controller
15 16 */
16 17 public function index()
17 18 {
18   - //
  19 + $houses = House::query()->orderByDesc('created_at')->orderByDesc('id')->paginate(25);
  20 + return view('admin.houses.index', compact('houses'));
  21 +
19 22 }
20 23  
21 24 /**
... ... @@ -25,7 +28,7 @@ class HousesController extends Controller
25 28 */
26 29 public function create()
27 30 {
28   - //
  31 + return view('admin.houses.create');
29 32 }
30 33  
31 34 /**
... ... @@ -34,9 +37,24 @@ class HousesController extends Controller
34 37 * @param \Illuminate\Http\Request $request
35 38 * @return \Illuminate\Http\Response
36 39 */
37   - public function store(Request $request)
  40 + public function store(HousesRequest $request)
38 41 {
39   - //
  42 + $params = $request->all();
  43 + //unset($params['foto_main']);
  44 +
  45 + if ($request->has('foto_main')) {
  46 + $params['foto_main'] = $request->file('foto_main')->store('houses', 'public');
  47 + }
  48 + if ($request->has('object_plan')) {
  49 + $params['object_plan'] = $request->file('object_plan')->store('houses', 'public');
  50 + }
  51 + if ($request->has('floor_plan')) {
  52 + $params['floor_plan'] = $request->file('floor_plan')->store('houses', 'public');
  53 + }
  54 +
  55 +
  56 + House::create($params);
  57 + return redirect()->route('admin.houses.index');
40 58 }
41 59  
42 60 /**
app/Http/Controllers/Admin/MessageAreaController.php
... ... @@ -15,7 +15,9 @@ class MessageAreaController extends Controller
15 15 */
16 16 public function index()
17 17 {
18   - //
  18 + $messages = ModelMailFeedback::query()->orderByDesc('created_at')->orderByDesc('id')->paginate(20);
  19 + return view('admin.messages.index', compact('messages'));
  20 +
19 21 }
20 22  
21 23 /**
... ... @@ -42,12 +44,12 @@ class MessageAreaController extends Controller
42 44 /**
43 45 * Display the specified resource.
44 46 *
45   - * @param \App\Models\ModelMailFeedback $modelMailFeedback
  47 + * @param \App\Models\ModelMailFeedback $message
46 48 * @return \Illuminate\Http\Response
47 49 */
48   - public function show(ModelMailFeedback $modelMailFeedback)
  50 + public function show(ModelMailFeedback $message)
49 51 {
50   - //
  52 + return view('admin.messages.view', compact('message'));
51 53 }
52 54  
53 55 /**
... ... @@ -76,11 +78,12 @@ class MessageAreaController extends Controller
76 78 /**
77 79 * Remove the specified resource from storage.
78 80 *
79   - * @param \App\Models\ModelMailFeedback $modelMailFeedback
  81 + * @param \App\Models\ModelMailFeedback $message
80 82 * @return \Illuminate\Http\Response
81 83 */
82   - public function destroy(ModelMailFeedback $modelMailFeedback)
  84 + public function destroy(ModelMailFeedback $message)
83 85 {
84   - //
  86 + $message->delete();
  87 + return redirect()->route('admin.message.index');
85 88 }
86 89 }
app/Http/Controllers/Admin/TypeAreaController.php
... ... @@ -4,7 +4,10 @@ namespace App\Http\Controllers\Admin;
4 4  
5 5 use App\Http\Controllers\Controller;
6 6 use App\Models\type_area;
  7 +use Illuminate\Database\Eloquent\Model;
7 8 use Illuminate\Http\Request;
  9 +use Illuminate\Support\Facades\Storage;
  10 +use Illuminate\Support\Facades\Validator;
8 11  
9 12 class TypeAreaController extends Controller
10 13 {
... ... @@ -15,7 +18,8 @@ class TypeAreaController extends Controller
15 18 */
16 19 public function index()
17 20 {
18   - //
  21 + $typeareas = type_area::query()->orderByDesc('created_at')->orderByDesc('id')->paginate(5);
  22 + return view('admin.typearea.index', compact('typeareas'));
19 23 }
20 24  
21 25 /**
... ... @@ -25,7 +29,7 @@ class TypeAreaController extends Controller
25 29 */
26 30 public function create()
27 31 {
28   - //
  32 + return view('admin.typearea.create');
29 33 }
30 34  
31 35 /**
... ... @@ -36,7 +40,23 @@ class TypeAreaController extends Controller
36 40 */
37 41 public function store(Request $request)
38 42 {
39   - //
  43 + $rules = [
  44 + 'name_type' => 'required|min:3|max:255',
  45 + ];
  46 + $messages = [
  47 + 'required' => 'Укажите обязательное поле',
  48 + ];
  49 +
  50 + $validator = Validator::make($request->all(), $rules, $messages);
  51 +
  52 + if ($validator->fails()) {
  53 + return redirect()->route('admin.typearea.create')
  54 + ->withErrors($validator);
  55 + } else {
  56 + $params = $request->all();
  57 + type_area::create($params);
  58 + return redirect()->route('admin.typearea.index');
  59 + }
40 60 }
41 61  
42 62 /**
... ... @@ -53,12 +73,12 @@ class TypeAreaController extends Controller
53 73 /**
54 74 * Show the form for editing the specified resource.
55 75 *
56   - * @param \App\Models\type_area $type_area
  76 + * @param \App\Models\type_area $typearea
57 77 * @return \Illuminate\Http\Response
58 78 */
59   - public function edit(type_area $type_area)
  79 + public function edit(type_area $typearea)
60 80 {
61   - //
  81 + return view('admin.typearea.edit', compact('typearea'));
62 82 }
63 83  
64 84 /**
... ... @@ -68,19 +88,36 @@ class TypeAreaController extends Controller
68 88 * @param \App\Models\type_area $type_area
69 89 * @return \Illuminate\Http\Response
70 90 */
71   - public function update(Request $request, type_area $type_area)
  91 + public function update(Request $request, type_area $typearea)
72 92 {
73   - //
  93 + $rules = [
  94 + 'name_type' => 'required|min:3|max:255',
  95 + ];
  96 + $messages = [
  97 + 'required' => 'Укажите обязательное поле',
  98 + ];
  99 +
  100 + $validator = Validator::make($request->all(), $rules, $messages);
  101 +
  102 + if ($validator->fails()) {
  103 + return redirect()->route('admin.typearea.edit')
  104 + ->withErrors($validator);
  105 + } else {
  106 + $params = $request->all();
  107 + $typearea->update($params);
  108 + return redirect()->route('admin.typearea.index');
  109 + }
74 110 }
75 111  
76 112 /**
77 113 * Remove the specified resource from storage.
78 114 *
79   - * @param \App\Models\type_area $type_area
  115 + * @param \App\Models\type_area $typearea
80 116 * @return \Illuminate\Http\Response
81 117 */
82   - public function destroy(type_area $type_area)
  118 + public function destroy(type_area $typearea)
83 119 {
84   - //
  120 + $typearea->delete();
  121 + return redirect()->route('admin.typearea.index');
85 122 }
86 123 }
app/Http/Requests/HousesRequest.php
... ... @@ -0,0 +1,30 @@
  1 +<?php
  2 +
  3 +namespace App\Http\Requests;
  4 +
  5 +use Illuminate\Foundation\Http\FormRequest;
  6 +
  7 +class HousesRequest extends FormRequest
  8 +{
  9 + /**
  10 + * Determine if the user is authorized to make this request.
  11 + *
  12 + * @return bool
  13 + */
  14 + public function authorize()
  15 + {
  16 + return false;
  17 + }
  18 +
  19 + /**
  20 + * Get the validation rules that apply to the request.
  21 + *
  22 + * @return array<string, mixed>
  23 + */
  24 + public function rules()
  25 + {
  26 + return [
  27 + //
  28 + ];
  29 + }
  30 +}
app/Models/format_area.php
... ... @@ -11,6 +11,8 @@ class format_area extends Model
11 11  
12 12 protected $table = 'format_area';
13 13  
  14 + protected $fillable = ['name_format'];
  15 +
14 16 /*
15 17 * Связь справочника-таблицы ФОРМАТ НЕДВИЖИМОСТИ с таблицей ОФИСЫ
16 18 */
app/Models/type_area.php
... ... @@ -11,6 +11,9 @@ class type_area extends Model
11 11  
12 12 protected $table = 'type_area';
13 13  
  14 + protected $fillable = ['name_type'];
  15 +
  16 +
14 17 /*
15 18 * Связь таблицы ТИП НЕДВИЖИМОСТИ с таблицей ОФИСЫ
16 19 */
resources/views/admin/company/add_partner.blade.php
... ... @@ -0,0 +1,37 @@
  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.company.show', ['company' => 1]) }}">Редактирование реквизитов компании </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.add.partner.post')}}" style="width:100%">
  20 + @csrf
  21 +
  22 + <label for="email">Название партнера: </label><br>
  23 + @error('name')
  24 + <div class="alert alert-danger">{{ $message }}</div>
  25 + @enderror
  26 + <input type="text" class="form-control_ txt" name="name" placeholder="Название партнера"
  27 + required maxlength="100" style="width: 80%" value=""><br>
  28 +
  29 + <label for="foto">Файл-картинка:</label>
  30 + <input type="file" class="form-control-file txt" name="foto" id="foto" accept="image/png, image/jpeg"><br><br>
  31 +
  32 + <button type="submit" class="btn hero-search__btn btn--main">Сохранить</button>
  33 + </form>
  34 + </div>
  35 + </div>
  36 + </section>
  37 +@endsection
resources/views/admin/company/view.blade.php
... ... @@ -48,13 +48,33 @@
48 48 <label for="title">Число лет на рынке (для компании): <b>{{$firm_data->year}}</b></label><br><br>
49 49  
50 50 <label for="title">Условие: <b>{{$firm_data->conf}}</b></label><br><br>
51   -
52   -
53   -
54   -
55   -
56   -
57 51 </div>
58 52 </div>
59 53 </section>
  54 + @if ($partners->count())
  55 + <section class="partners">
  56 + <div class="container">
  57 + <h2 class="partners__title title">Партнеры нашей компании</h2>
  58 +
  59 + <a href="{{ route('admin.add.partner') }}" class="btn hero-search__btn btn--main">
  60 + Добавить партнера
  61 + </a><br>
  62 + <div class="partners__swiper swiper" data-mobile="false">
  63 + <div class="swiper-wrapper">
  64 + <div class="swiper-slide">
  65 + <div class="partners__inner">
  66 + @foreach ($partners as $partner)
  67 + <div class="partners-item"><img src="{{ asset(Storage::url($partner->foto)) }}" alt="{{ $partner->name }}" loading="lazy">
  68 + <a href="{{ route('admin.delete.partner', ['partner' => $partner->id]) }}">Удалить партнера</a>
  69 + </div>
  70 + @endforeach
  71 +
  72 + </div>
  73 + </div>
  74 + </div>
  75 + <div class="swiper-scrollbar"></div>
  76 + </div>
  77 + </div>
  78 + </section><br><br>
  79 + @endif
60 80 @endsection
resources/views/admin/formatarea/create.blade.php
... ... @@ -0,0 +1,25 @@
  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.formatarea.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.formatarea.store') }}" style="width:100%">
  20 + @include('admin.formatarea.form')
  21 + </form>
  22 + </div>
  23 + </div>
  24 + </section>
  25 +@endsection
resources/views/admin/formatarea/edit.blade.php
... ... @@ -0,0 +1,25 @@
  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.formatarea.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.formatarea.update', ['formatarea' => $formatarea->id])}}" style="width:100%">
  20 + @include('admin.formatarea.form')
  21 + </form>
  22 + </div>
  23 + </div>
  24 + </section>
  25 +@endsection
resources/views/admin/formatarea/form.blade.php
... ... @@ -0,0 +1,16 @@
  1 +@csrf
  2 +
  3 +@isset($formatarea)
  4 + @method('PUT')
  5 +@endisset
  6 +
  7 +<label for="name_format">Формат недвижимости: <span class="req">*</span></label>
  8 +@error('name_format')
  9 +<div class="alert alert-danger">{{ $message }}</div>
  10 +@enderror
  11 +<br>
  12 +<input type="text" class="form-control_ txt" name="name_format" placeholder="Формат недвижимости"
  13 + required maxlength="100" style="width: 60%" value="{{ old('name_format') ?? $formatarea->name_format ?? '' }}"><br>
  14 +
  15 +<br>
  16 +<button type="submit" class="btn hero-search__btn btn--main">Сохранить</button>
resources/views/admin/formatarea/index.blade.php
... ... @@ -0,0 +1,67 @@
  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"><span class="breadcrumbs__link">Форматы недвижимости </span></li>
  11 + </ul>
  12 + </div>
  13 + <h1 class="favorites__title title-main">Форматы недвижимости</h1>
  14 + </div>
  15 + </div>
  16 + <div class="favorites-cnt">
  17 + <div class="container">
  18 + <a href="{{ route('admin.formatarea.create') }}" class="btn hero-search__btn btn--main">
  19 + Создать формат
  20 + </a><br><br>
  21 + <table class="table" style="width: 100%">
  22 + <thead>
  23 + <tr>
  24 + <th>ID</th>
  25 + <th>Название формата</th>
  26 + <th>Дата создания</th>
  27 + <th>Действия</th>
  28 + </tr>
  29 + </thead>
  30 + <tbody>
  31 + @if ($formatareas->count())
  32 + @foreach($formatareas as $formatarea)
  33 + <tr>
  34 + <td>{{ $formatarea->id }}</td>
  35 + <td>{{ $formatarea->name_format }}</td>
  36 + <td>{{ $formatarea->created_at }}</td>
  37 + <td> <form action="{{ route('admin.formatarea.destroy', $formatarea) }}" method="POST">
  38 + <a href="{{ route('admin.formatarea.edit', ['formatarea' => $formatarea->id]) }}">
  39 + Редактировать
  40 + </a> |
  41 + @csrf
  42 + @method('DELETE')
  43 + <input class=" btn-danger" type="submit" value="Удалить">
  44 + </form>
  45 + </td>
  46 + </tr>
  47 + @endforeach
  48 + @else
  49 + <tr>
  50 + <td>-</td>
  51 + <td>-</td>
  52 + <td>-</td>
  53 + <td>-</td>
  54 + <td>-</td>
  55 + </tr>
  56 + @endif
  57 +
  58 + </tbody>
  59 + </table>
  60 + {{ $formatareas->onEachSide(1)->links('catalogs.paginate') }}
  61 + <div class="favorites__items">
  62 +
  63 + </div>
  64 + </div>
  65 + </div>
  66 + </section>
  67 +@endsection
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
... ... @@ -0,0 +1,78 @@
  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"><span class="breadcrumbs__link">Офисы </span></li>
  11 + </ul>
  12 + </div>
  13 + <h1 class="favorites__title title-main">Офисы</h1>
  14 + </div>
  15 + </div>
  16 + <div class="favorites-cnt">
  17 + <div class="container">
  18 + <a href="{{ route('admin.houses.create') }}" class="btn hero-search__btn btn--main">
  19 + Создать офис
  20 + </a><br><br>
  21 + <table class="table" style="width: 100%">
  22 + <thead>
  23 + <tr>
  24 + <th>Фото</th>
  25 + <th>ID</th>
  26 + <th>Название офиса</th>
  27 + <th>Жилой комплекс</th>
  28 + <th>Адрес</th>
  29 + <th>Дата создания</th>
  30 + <th>Действия</th>
  31 + </tr>
  32 + </thead>
  33 + <tbody>
  34 + @if ($houses->count())
  35 + @foreach($houses as $house)
  36 + <tr>
  37 + <td><? if (empty($house->foto_main)) {?>Нет фото<?} else {?><img src="<?=asset(Storage::url($house->foto_main))?>" width="100px"/><?}?></td>
  38 + <td>{{ $house->id }}</td>
  39 + <td>{{ $house->title }}</td>
  40 + <td>{{ $house->areas->name_area }}</td>
  41 + <td>{{ $house->address }}</td>
  42 + <td>{{ $house->created_at }}</td>
  43 + <td> <form action="{{ route('admin.houses.destroy', $house) }}" method="POST">
  44 + <a style="color:green" target="_blank" href="{{ route('offer', ['house' => $house->id]) }}">
  45 + Просмотр
  46 + </a> |
  47 + <a href="{{ route('admin.houses.edit', ['house' => $house->id]) }}">
  48 + Редактировать
  49 + </a> |
  50 + @csrf
  51 + @method('DELETE')
  52 + <input class=" btn-danger" type="submit" value="Удалить">
  53 + </form>
  54 + </td>
  55 + </tr>
  56 + @endforeach
  57 + @else
  58 + <tr>
  59 + <td>-</td>
  60 + <td>-</td>
  61 + <td>-</td>
  62 + <td>-</td>
  63 + <td>-</td>
  64 + <td>-</td>
  65 + <td>-</td>
  66 + </tr>
  67 + @endif
  68 +
  69 + </tbody>
  70 + </table>
  71 + {{ $houses->onEachSide(1)->links('catalogs.paginate') }}
  72 + <div class="favorites__items">
  73 +
  74 + </div>
  75 + </div>
  76 + </div>
  77 + </section>
  78 +@endsection
resources/views/admin/messages/index.blade.php
... ... @@ -0,0 +1,64 @@
  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"><span class="breadcrumbs__link">Сообщения сайту </span></li>
  11 + </ul>
  12 + </div>
  13 + <h1 class="favorites__title title-main">Сообщения сайту</h1>
  14 + </div>
  15 + </div>
  16 + <div class="favorites-cnt">
  17 + <div class="container">
  18 + <table class="table" style="width: 100%">
  19 + <thead>
  20 + <tr>
  21 + <th>ID</th>
  22 + <th>От</th>
  23 + <th>Тема</th>
  24 + <th>Дата</th>
  25 + <th>Действия</th>
  26 + </tr>
  27 + </thead>
  28 + <tbody>
  29 + @if ($messages->count())
  30 + @foreach($messages as $msg)
  31 + <tr>
  32 + <td>{{ $msg->id }}</td>
  33 + <td>{{ $msg->from }}</td>
  34 + <td>{{ $msg->subject }}</td>
  35 + <td>{{ $msg->created_at }}</td>
  36 + <td> <form action="{{ route('admin.message.destroy', $msg) }}" method="POST">
  37 + <a href="{{ route('admin.message.show', $msg) }}">Просмотр</a> |
  38 + @csrf
  39 + @method('DELETE')
  40 + <input class=" btn-danger" type="submit" value="Удалить">
  41 + </form>
  42 + </td>
  43 + </tr>
  44 + @endforeach
  45 + @else
  46 + <tr>
  47 + <td>-</td>
  48 + <td>-</td>
  49 + <td>-</td>
  50 + <td>-</td>
  51 + <td>-</td>
  52 + </tr>
  53 + @endif
  54 +
  55 + </tbody>
  56 + </table>
  57 + {{ $messages->onEachSide(1)->links('catalogs.paginate') }}
  58 + <div class="favorites__items">
  59 +
  60 + </div>
  61 + </div>
  62 + </div>
  63 + </section>
  64 +@endsection
resources/views/admin/messages/view.blade.php
... ... @@ -0,0 +1,36 @@
  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.message.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 +
  20 + <label for="ID">ID: <b>{{$message->id}}</b></label><br><br>
  21 +
  22 + <label for="telephone">Сообщение от: <b>{{$message->from}}</b></label><br><br>
  23 +
  24 + <label for="title">Сообщение для: <b>{{$message->to}}</b></label><br><br>
  25 +
  26 + <label>Тема: <b>{{$message->subject}}</b></label><br><br>
  27 +
  28 + <label>Форма-отправитель: <b>{{$message->form}}</b></label><br><br>
  29 +
  30 + <label>Текст: <b>{{$message->text}}</b></label><br><br>
  31 +
  32 + <label>Дата сообщения: <b>{{$message->created_at}}</b></label><br><br>
  33 + </div>
  34 + </div>
  35 + </section>
  36 +@endsection
resources/views/admin/news/edit.blade.php
1   -@extends('layout.admin', ['title' => 'Создание новости'])
  1 +@extends('layout.admin', ['title' => 'Редактирование новости'])
2 2  
3 3 @section('content')
4 4 <section class="favorites">
resources/views/admin/typearea/create.blade.php
... ... @@ -0,0 +1,25 @@
  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.typearea.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.typearea.store') }}" style="width:100%">
  20 + @include('admin.typearea.form')
  21 + </form>
  22 + </div>
  23 + </div>
  24 + </section>
  25 +@endsection
resources/views/admin/typearea/edit.blade.php
... ... @@ -0,0 +1,25 @@
  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.typearea.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.typearea.update', ['typearea' => $typearea->id])}}" style="width:100%">
  20 + @include('admin.typearea.form')
  21 + </form>
  22 + </div>
  23 + </div>
  24 + </section>
  25 +@endsection
resources/views/admin/typearea/form.blade.php
... ... @@ -0,0 +1,16 @@
  1 +@csrf
  2 +
  3 +@isset($typearea)
  4 + @method('PUT')
  5 +@endisset
  6 +
  7 +<label for="name_type">Тип недвижимости: <span class="req">*</span></label>
  8 +@error('name_type')
  9 +<div class="alert alert-danger">{{ $message }}</div>
  10 +@enderror
  11 +<br>
  12 +<input type="text" class="form-control_ txt" name="name_type" placeholder="Тип недвижимости"
  13 + required maxlength="100" style="width: 60%" value="{{ old('name_type') ?? $typearea->name_type ?? '' }}"><br>
  14 +
  15 +<br>
  16 +<button type="submit" class="btn hero-search__btn btn--main">Сохранить</button>
resources/views/admin/typearea/index.blade.php
... ... @@ -0,0 +1,67 @@
  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"><span class="breadcrumbs__link">Типы недвижимости </span></li>
  11 + </ul>
  12 + </div>
  13 + <h1 class="favorites__title title-main">Типы недвижимости</h1>
  14 + </div>
  15 + </div>
  16 + <div class="favorites-cnt">
  17 + <div class="container">
  18 + <a href="{{ route('admin.typearea.create') }}" class="btn hero-search__btn btn--main">
  19 + Создать тип
  20 + </a><br><br>
  21 + <table class="table" style="width: 100%">
  22 + <thead>
  23 + <tr>
  24 + <th>ID</th>
  25 + <th>Название типа</th>
  26 + <th>Дата создания</th>
  27 + <th>Действия</th>
  28 + </tr>
  29 + </thead>
  30 + <tbody>
  31 + @if ($typeareas->count())
  32 + @foreach($typeareas as $typearea)
  33 + <tr>
  34 + <td>{{ $typearea->id }}</td>
  35 + <td>{{ $typearea->name_type }}</td>
  36 + <td>{{ $typearea->created_at }}</td>
  37 + <td> <form action="{{ route('admin.typearea.destroy', $typearea) }}" method="POST">
  38 + <a href="{{ route('admin.typearea.edit', ['typearea' => $typearea->id]) }}">
  39 + Редактировать
  40 + </a> |
  41 + @csrf
  42 + @method('DELETE')
  43 + <input class=" btn-danger" type="submit" value="Удалить">
  44 + </form>
  45 + </td>
  46 + </tr>
  47 + @endforeach
  48 + @else
  49 + <tr>
  50 + <td>-</td>
  51 + <td>-</td>
  52 + <td>-</td>
  53 + <td>-</td>
  54 + <td>-</td>
  55 + </tr>
  56 + @endif
  57 +
  58 + </tbody>
  59 + </table>
  60 + {{ $typeareas->onEachSide(1)->links('catalogs.paginate') }}
  61 + <div class="favorites__items">
  62 +
  63 + </div>
  64 + </div>
  65 + </div>
  66 + </section>
  67 +@endsection
resources/views/layout/admin.blade.php
... ... @@ -86,7 +86,11 @@
86 86 <li class="nav__item"><a class="nav__link" href="{{ route('admin.area.index') }}">Объекты</a></li>
87 87 <li class="nav__item"><a class="nav__link" href="{{ route('admin.news.index') }}">Новости</a></li>
88 88 <li class="nav__item"><a class="nav__link" href="{{ route('admin.company.show', ['company' => 1]) }}">Компания</a></li>
89   - <li class="nav__item"><a class="nav__link nav__link-favorites" href="{{ route('favorite') }}">Избранное<span><?=\App\Classes\RusDate::count_item_fav();?></span></a></li>
  89 + <li class="nav__item"><a class="nav__link" href="{{ route('admin.typearea.index') }}">Типы</a></li>
  90 + <li class="nav__item"><a class="nav__link" href="{{ route('admin.formatarea.index') }}">Форматы</a></li>
  91 + <li class="nav__item"><a class="nav__link" href="{{ route('admin.message.index') }}">Сообщения</a></li>
  92 + <li class="nav__item"><a class="nav__link" href="{{ route('admin.houses.index') }}">Офисы</a></li>
  93 +
90 94 </ul>
91 95 </nav>
92 96 <div class="header__buttons"><a class="header__btn-phone" href="#" data-btn="feedback">
... ... @@ -112,8 +116,10 @@
112 116 <li class="menu__item"><a class="menu__link" href="{{ route('admin.area.index') }}">Объекты</a></li>
113 117 <li class="menu__item"><a class="menu__link" href="{{ route('admin.news.index') }}">Новости</a></li>
114 118 <li class="menu__item"><a class="menu__link" href="{{ route('admin.company.show', ['company' => 1]) }}">Компания</a></li>
115   - <li class="menu__item"><a class="menu__link" href="{{ route('news') }}">Новости</a></li>
116   - <li class="menu__item"><a class="menu__link" href="{{ route('contact') }}">Контакты</a></li>
  119 + <li class="menu__item"><a class="menu__link" href="{{ route('admin.typearea.index') }}">Типы недвижимости</a></li>
  120 + <li class="menu__item"><a class="menu__link" href="{{ route('admin.formatarea.index') }}">Форматы недвижимости</a></li>
  121 + <li class="menu__item"><a class="menu__link" href="{{ route('admin.message.index') }}">Сообщения</a></li>
  122 + <li class="menu__item"><a class="menu__link" href="{{ route('admin.houses.index') }}">Офисы</a></li>
117 123 </ul>
118 124 </nav>
119 125 <div class="menu__contacts"><a class="menu__contact" href="mailto:info@renttorg.ru">E-MAIL<span>info@renttorg.ru</span></a><a class="menu__contact" href="tel:+79290127262">ТЕЛЕФОН<span>+7 (929) 012-72-62</span></a></div>
... ... @@ -163,4 +163,34 @@ Route::group([
163 163 */
164 164 Route::resource('company', CompanyAreaController::class, ['except' => ['create', 'store', 'destroy', 'index']]);
165 165  
  166 + //форма добавление партнера
  167 + Route::get('add/partner', [CompanyAreaController::class, 'add_partner'])->name('add.partner');
  168 +
  169 + //Добавление партнера
  170 + Route::post('add/partner', [CompanyAreaController::class, 'add_partner_post'])->name('add.partner.post');
  171 +
  172 + //удаление партнера
  173 + Route::get('delete/partner/{partner}', [CompanyAreaController::class, 'delete_partner'])->name('delete.partner');
  174 +
  175 +
  176 + /*
  177 + * CRUD-операции над типами недвижимостью
  178 + */
  179 + Route::resource('typearea', TypeAreaController::class, ['except' => ['show']]);
  180 +
  181 + /*
  182 + * CRUD-операции над форматами недвижимостью
  183 + */
  184 + Route::resource('formatarea', FormatAreaController::class, ['except' => ['show']]);
  185 +
  186 + /*
  187 + * CRUD-операции над сообщениями сайта
  188 + */
  189 + Route::resource('message', MessageAreaController::class, ['except' => ['create', 'store', 'edit', 'update']]);
  190 +
  191 + /*
  192 + * CRUD-операции над офисами
  193 + */
  194 + Route::resource('houses', HousesController::class, ['except' => ['show']]);
  195 +
166 196 });