diff --git a/app/Enums/EnumTraits/EnumToArray.php b/app/Enums/EnumTraits/EnumToArray.php new file mode 100644 index 0000000..9c37688 --- /dev/null +++ b/app/Enums/EnumTraits/EnumToArray.php @@ -0,0 +1,11 @@ +whereIn('name', $block_names) + ->get() + ->keyBy('name') + ->toArray(); + return view('admin.counters_main.index', compact('block_names', 'blocks')); + } + + public function counters_main_update(Request $request, string $name) { + PageContent::updateOrCreate( + ['name' => $name], + array_merge(['name' => $name], $request->all()) + ); + $block_names = MainPageCounters::values();; + $blocks = PageContent::select('name', 'title', 'description', 'extra') + ->whereIn('name', $block_names) + ->get() + ->keyBy('name') + ->toArray(); + return view('admin.counters_main.index', compact('block_names', 'blocks')); + } + //////////////////////////////////////////////////////////////////////////////// // кабинет - редактор шапки-футера сайта public function editblocks(Request $request) { diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 38f21d5..1c67f58 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -10,7 +10,6 @@ use App\Models\Ad_employer; use App\Models\Ad_jobs; use App\Models\Category; use App\Models\Education; -use App\Models\Employer; use App\Models\employers_main; use App\Models\Job_title; use App\Models\Like_vacancy; @@ -25,7 +24,8 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Validator; -use App\Classes\StatusUser; +use App\Models\PageContent; +use App\Enums\MainPageCounters; class MainController extends Controller { @@ -96,7 +96,16 @@ class MainController extends Controller })-> orderBy('sort')->get(); $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); - return view('index', compact('news', 'Job_title', 'categories', 'employers', 'vacancy', 'Main_Job')); + + $block_names = MainPageCounters::values();; + $blocks_counters = PageContent::select('name', 'title', 'description', 'extra') + ->whereIn('name', $block_names) + ->orderBy('name', 'asc') + ->get() + ->keyBy('name') + ->toArray(); + + return view('index', compact('news', 'Job_title', 'categories', 'employers', 'vacancy', 'Main_Job', 'blocks_counters')); } public function search_vacancies(Request $request) { diff --git a/app/Models/PageContent.php b/app/Models/PageContent.php new file mode 100644 index 0000000..86386a2 --- /dev/null +++ b/app/Models/PageContent.php @@ -0,0 +1,18 @@ + '', 'prefix_indexes' => true, 'strict' => true, - 'engine' => null, + 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], diff --git a/database/migrations/2024_06_18_110133_create_page_contents_table.php b/database/migrations/2024_06_18_110133_create_page_contents_table.php new file mode 100644 index 0000000..28eb6c2 --- /dev/null +++ b/database/migrations/2024_06_18_110133_create_page_contents_table.php @@ -0,0 +1,35 @@ +id(); + $table->string('name')->unique(); + $table->string('title'); + $table->string('description'); + $table->string('extra'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('page_contents'); + } +}; diff --git a/resources/views/TITLE_TEXT.blade.php b/resources/views/TITLE_TEXT.blade.php deleted file mode 100644 index 83ecec1..0000000 --- a/resources/views/TITLE_TEXT.blade.php +++ /dev/null @@ -1,18 +0,0 @@ -
- 555+ - Резюме - Банальные, но неопровержимые выводы, а также элементы политического процесса лишь добавляют - фракционных разногласий и призваны к ответу. -
-
- 1 001+ - Вакансий - В рамках спецификации современных стандартов, диаграммы связей заблокированы в рамках своих - собственных рациональных ограничений. -
-
- 265 - Компаний - Но сторонники тоталитаризма в науке заблокированы в рамках своих собственных рациональных - ограничений. -
diff --git a/resources/views/admin/counters_main/form.blade.php b/resources/views/admin/counters_main/form.blade.php new file mode 100644 index 0000000..a2037a1 --- /dev/null +++ b/resources/views/admin/counters_main/form.blade.php @@ -0,0 +1,47 @@ +
+
+ +
+ +
+ +
+ +
+ +
diff --git a/resources/views/admin/counters_main/index.blade.php b/resources/views/admin/counters_main/index.blade.php new file mode 100644 index 0000000..45ffb7b --- /dev/null +++ b/resources/views/admin/counters_main/index.blade.php @@ -0,0 +1,10 @@ +@extends('layout.admin', ['title' => 'Админка - Редактор счетчиков на главной странице']) + +@section('content') + @foreach ($block_names as $block_name) +
+ @csrf + @include('admin.counters_main.form') +
+ @endforeach +@endsection diff --git a/resources/views/employers/bd.blade.php b/resources/views/employers/bd.blade.php index e5fa28c..e680165 100644 --- a/resources/views/employers/bd.blade.php +++ b/resources/views/employers/bd.blade.php @@ -105,62 +105,48 @@ $categories = 0; @endphp + @if ($users->count()) @foreach ($users as $key => $it) - @if (isset($it->workers[0]->position_work)) - @if ($categories !== $it->workers[0]->position_work) - @php - $categories = $it->workers[0]->position_work; - $i = 0; - @endphp - @endif - - @if ($i == 0) - - @endif - - {{ $it->surname." ".$it->name_man }}
{{ $it->surname2 }} - - - - @if (!empty($it->workers[0]->telephone)) - - {{ $it->workers[0]->telephone }} - - @else - - - @endif - - @if (!empty($it->workers[0]->telephone2)) -
- {{ $it->workers[0]->telephone2 }} - - @endif - - - - @if (!empty($it->workers[0]->email)) - {{ $it->workers[0]->email }} - @else - - - @endif - - - - @if (isset($it->workers[0]->id)) - - - - - Скачать - - @endif - - - @php $i++ @endphp - - - @endif + + {{ $it->surname." ".$it->name_man }}
{{ $it->surname2 }} + + + + @if (!empty($it->workers[0]->telephone)) + + {{ $it->workers[0]->telephone }} + + @else + - + @endif + + @if (!empty($it->workers[0]->telephone2)) +
+ {{ $it->workers[0]->telephone2 }} + + @endif + + + + @if (!empty($it->workers[0]->email)) + {{ $it->workers[0]->email }} + @else + - + @endif + + + + @if (isset($it->workers[0]->id)) + + + + + Скачать + + @endif + + @endforeach @endif diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index 05eaf4c..8cb921a 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -66,13 +66,23 @@ + +@if ($blocks_counters)
- @include('TITLE_TEXT') + @foreach($blocks_counters as $block_counter) +
+ {{$block_counter['extra']}} + {{$block_counter['title']}} + {{$block_counter['description']}} +
+ @endforeach
+@endif +