diff --git a/app/Http/Controllers/Admin/CompanyController.php b/app/Http/Controllers/Admin/CompanyController.php
index d72a119..0533a04 100644
--- a/app/Http/Controllers/Admin/CompanyController.php
+++ b/app/Http/Controllers/Admin/CompanyController.php
@@ -3,6 +3,11 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
+use App\Models\Employer;
+use App\Models\employers_main;
+use App\Models\Job_title;
+use App\Models\job_titles_main;
+use App\Models\pages;
use Illuminate\Http\Request;
class CompanyController extends Controller
@@ -18,13 +23,39 @@ class CompanyController extends Controller
}
// кабинет - редактор должности на главной
- public function job_titles_main() {
- return;
+ public function job_titles_main(Request $request) {
+ if ($request->ajax()) {
+ $user = job_titles_main::find($request->id);
+ $request->offsetUnset('id');
+ $user->update($request->all());
+ }
+
+ $jobs = job_titles_main::query()->OrderBy('sort')->paginate(10);
+ $list_job_titles = Job_title::query()->active()->orderBy('name')->get();
+
+ if ($request->ajax()) {
+ return view('admin.job_main.index_ajax', compact('jobs', 'list_job_titles'));
+ } else {
+ return view('admin.job_main.index', compact('jobs', 'list_job_titles'));
+ }
}
// кабинет - редактор работодатели на главной
- public function employers_main() {
- return;
+ public function employers_main(Request $request) {
+ if ($request->ajax()) {
+ $user = employers_main::find($request->id);
+ $request->offsetUnset('id');
+ $user->update($request->all());
+ }
+
+ $employers = employers_main::query()->OrderBy('sort')->paginate(10);
+ $list_employers = Employer::query()->active()->orderBy('name_company')->get();
+
+ if ($request->ajax()) {
+ return view('admin.employer_main.index_ajax', compact('employers', 'list_employers'));
+ } else {
+ return view('admin.employer_main.index', compact('employers', 'list_employers'));
+ }
}
// кабинет - редактор seo-сайта
@@ -32,10 +63,32 @@ class CompanyController extends Controller
return;
}
- // кабинет - редактор страниц
+ /////////// кабинет - редактор страниц ////////////////////////////////
public function editor_pages() {
- return;
+ $pages = pages::query()->OrderBy('name')->paginate(15);
+ return view('admin.pages.index', compact('pages'));
+ }
+
+ public function editor_pages_add() {
+ return view('admin.pages.add');
+ }
+
+ public function editor_pages_store(Request $request) {
+ return;
+ }
+
+ public function editor_pages_edit(pages $page) {
+ return view('admin.pages.edit', compact('page'));
+ }
+
+ public function editor_pages_update(Request $request, pages $page) {
+ return;
+ }
+
+ public function editor_pages_destroy(pages $page) {
+ return;
}
+ ///////////////////////////////////////////////////////////////////
// кабинет - реклама сайта
public function reclames() {
diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php
new file mode 100644
index 0000000..2ac9d42
--- /dev/null
+++ b/app/Http/Controllers/PagesController.php
@@ -0,0 +1,12 @@
+
+ */
+ public function rules()
+ {
+ return [
+ //
+ ];
+ }
+}
diff --git a/app/Models/employers_main.php b/app/Models/employers_main.php
index 2821c1f..3ba1f00 100644
--- a/app/Models/employers_main.php
+++ b/app/Models/employers_main.php
@@ -8,4 +8,18 @@ use Illuminate\Database\Eloquent\Model;
class employers_main extends Model
{
use HasFactory;
+
+ protected $fillable = [
+ 'name',
+ 'employer_id',
+ 'sort',
+ ];
+
+ /*
+ * Связь таблицы employers с таблицей employers_main
+ многие-к-одному
+ */
+ public function employer() {
+ return $this->belongsTo(Employer::class, 'employer_id');
+ }
}
diff --git a/app/Models/job_titles_main.php b/app/Models/job_titles_main.php
index 71b1775..704b991 100644
--- a/app/Models/job_titles_main.php
+++ b/app/Models/job_titles_main.php
@@ -8,4 +8,10 @@ use Illuminate\Database\Eloquent\Model;
class job_titles_main extends Model
{
use HasFactory;
+
+ protected $fillable = [
+ 'name',
+ 'job_title_id',
+ 'sort',
+ ];
}
diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php
index 76d96dc..dcb8859 100644
--- a/database/seeders/DatabaseSeeder.php
+++ b/database/seeders/DatabaseSeeder.php
@@ -14,6 +14,13 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
+ $this->call(EmployersMainSeeder::class);
+ $this->command->info('Таблица работодатели на главной загружена!');
+
+ $this->call(JobTitlesMainSeeder::class);
+ $this->command->info('Таблица должности на главной загружена!');
+
+
// \App\Models\User::factory(10)->create();
// \App\Models\User::factory()->create([
diff --git a/database/seeders/EmployersMainSeeder.php b/database/seeders/EmployersMainSeeder.php
new file mode 100644
index 0000000..aaa2fc8
--- /dev/null
+++ b/database/seeders/EmployersMainSeeder.php
@@ -0,0 +1,71 @@
+ 'Пункт 1',
+ 'employer_id' => '0',
+ 'sort' => '100',
+
+ ],
+ /*2*/[
+ 'name' => 'Пункт 2',
+ 'employer_id' => '0',
+ 'sort' => '110',
+ ],
+ /*3*/[
+ 'name' => 'Пункт 3',
+ 'employer_id' => '0',
+ 'sort' => '120',
+ ],
+ /*4*/[
+ 'name' => 'Пункт 4',
+ 'employer_id' => '0',
+ 'sort' => '130',
+ ],
+ /*5*/[
+ 'name' => 'Пункт 5',
+ 'employer_id' => '0',
+ 'sort' => '140',
+ ],
+ /*6*/[
+ 'name' => 'Пункт 6',
+ 'employer_id' => '0',
+ 'sort' => '150',
+ ],
+ /*7*/[
+ 'name' => 'Пункт 7',
+ 'employer_id' => '0',
+ 'sort' => '160',
+ ],
+ /*8*/[
+ 'name' => 'Пункт 8',
+ 'employer_id' => '0',
+ 'sort' => '170',
+ ],
+ ];
+
+ foreach ($data as $item) {
+ $emp = new employers_main();
+ $emp->name = $item['name'];
+ $emp->employer_id = $item['employer_id'];
+ $emp->sort = $item['sort'];
+ $emp->save();
+ }
+ }
+}
diff --git a/database/seeders/JobTitlesMainSeeder.php b/database/seeders/JobTitlesMainSeeder.php
new file mode 100644
index 0000000..7befd3a
--- /dev/null
+++ b/database/seeders/JobTitlesMainSeeder.php
@@ -0,0 +1,71 @@
+ 'Пункт 1',
+ 'job_title_id' => '0',
+ 'sort' => '100',
+
+ ],
+ /*2*/[
+ 'name' => 'Пункт 2',
+ 'job_title_id' => '0',
+ 'sort' => '110',
+ ],
+ /*3*/[
+ 'name' => 'Пункт 3',
+ 'job_title_id' => '0',
+ 'sort' => '120',
+ ],
+ /*4*/[
+ 'name' => 'Пункт 4',
+ 'job_title_id' => '0',
+ 'sort' => '130',
+ ],
+ /*5*/[
+ 'name' => 'Пункт 5',
+ 'job_title_id' => '0',
+ 'sort' => '140',
+ ],
+ /*6*/[
+ 'name' => 'Пункт 6',
+ 'job_title_id' => '0',
+ 'sort' => '150',
+ ],
+ /*7*/[
+ 'name' => 'Пункт 7',
+ 'job_title_id' => '0',
+ 'sort' => '160',
+ ],
+ /*8*/[
+ 'name' => 'Пункт 8',
+ 'job_title_id' => '0',
+ 'sort' => '170',
+ ],
+ ];
+
+ foreach ($data as $item) {
+ $emp = new job_titles_main();
+ $emp->name = $item['name'];
+ $emp->job_title_id = $item['job_title_id'];
+ $emp->sort = $item['sort'];
+ $emp->save();
+ }
+ }
+}
diff --git a/resources/views/admin/category/index.blade.php b/resources/views/admin/category/index.blade.php
index b5fc50f..d201722 100644
--- a/resources/views/admin/category/index.blade.php
+++ b/resources/views/admin/category/index.blade.php
@@ -1,45 +1,11 @@
@extends('layout.admin', ['title' => 'Админка - Категории'])
@section('script')
-
@endsection
@section('search')
-
+
@endsection
@section('content')
-
+
Добавить категорию
diff --git a/resources/views/admin/employer_main/index.blade.php b/resources/views/admin/employer_main/index.blade.php
new file mode 100644
index 0000000..bf60495
--- /dev/null
+++ b/resources/views/admin/employer_main/index.blade.php
@@ -0,0 +1,139 @@
+@extends('layout.admin', ['title' => 'Админка - Работодатели на главной'])
+
+@section('script')
+
+@endsection
+
+@section('search')
+
+@endsection
+
+@section('content')
+
+
+
+
+
+
+ № |
+ Название пункта |
+ Название компании |
+ Сортировка |
+
+
+
+ foreach($employers as $emp) {?>
+
+
+ {{$emp->id}}
+ |
+
+ {{$emp->name}}
+ |
+
+
+ |
+
+
+ |
+
+ } ?>
+
+
+
+
+
+ =$employers->appends($_GET)->links('admin.pagginate'); ?>
+
+
+@endsection
diff --git a/resources/views/admin/employer_main/index_ajax.blade.php b/resources/views/admin/employer_main/index_ajax.blade.php
new file mode 100644
index 0000000..9e9b6b9
--- /dev/null
+++ b/resources/views/admin/employer_main/index_ajax.blade.php
@@ -0,0 +1,63 @@
+
+
+
+
+ № |
+ Название пункта |
+ Название компании |
+ Сортировка |
+
+
+
+ foreach($employers as $emp) {?>
+
+
+ {{$emp->id}}
+ |
+
+ {{$emp->name}}
+ |
+
+
+ |
+
+
+ |
+
+ } ?>
+
+
+
+
+
+ =$employers->appends($_GET)->links('admin.pagginate'); ?>
+
diff --git a/resources/views/admin/job_main/index.blade.php b/resources/views/admin/job_main/index.blade.php
new file mode 100644
index 0000000..ce5ca86
--- /dev/null
+++ b/resources/views/admin/job_main/index.blade.php
@@ -0,0 +1,139 @@
+@extends('layout.admin', ['title' => 'Админка - Должности на главной'])
+
+@section('script')
+
+@endsection
+
+@section('search')
+
+@endsection
+
+@section('content')
+
+
+
+
+
+
+ № |
+ Название пункта |
+ Должность |
+ Сортировка |
+
+
+
+ foreach($jobs as $job) {?>
+
+
+ {{$job->id}}
+ |
+
+ {{$job->name}}
+ |
+
+
+ |
+
+
+ |
+
+ } ?>
+
+
+
+
+
+ =$jobs->appends($_GET)->links('admin.pagginate'); ?>
+
+
+@endsection
diff --git a/resources/views/admin/job_main/index_ajax.blade.php b/resources/views/admin/job_main/index_ajax.blade.php
new file mode 100644
index 0000000..2fc0f3f
--- /dev/null
+++ b/resources/views/admin/job_main/index_ajax.blade.php
@@ -0,0 +1,63 @@
+
+
+
+
+ № |
+ Название пункта |
+ Должность |
+ Сортировка |
+
+
+
+ foreach($jobs as $job) {?>
+
+
+ {{$job->id}}
+ |
+
+ {{$job->name}}
+ |
+
+
+ |
+
+
+ |
+
+ } ?>
+
+
+
+
+
+ =$jobs->appends($_GET)->links('admin.pagginate'); ?>
+
diff --git a/resources/views/admin/messages.blade.php b/resources/views/admin/messages.blade.php
index 03a953e..0753786 100644
--- a/resources/views/admin/messages.blade.php
+++ b/resources/views/admin/messages.blade.php
@@ -1,4 +1,4 @@
-@extends('layout.admin', ['title' => 'Админка - Вакансии'])
+@extends('layout.admin', ['title' => 'Админка - Сообщения'])
@section('script')
@endsection
diff --git a/resources/views/admin/pages/add.blade.php b/resources/views/admin/pages/add.blade.php
new file mode 100644
index 0000000..5a5247a
--- /dev/null
+++ b/resources/views/admin/pages/add.blade.php
@@ -0,0 +1,7 @@
+@extends('layout.admin', ['title' => 'Админка - Добавление страницы'])
+
+@section('content')
+
+@endsection
diff --git a/resources/views/admin/pages/edit.blade.php b/resources/views/admin/pages/edit.blade.php
new file mode 100644
index 0000000..753c3e1
--- /dev/null
+++ b/resources/views/admin/pages/edit.blade.php
@@ -0,0 +1,7 @@
+@extends('layout.admin', ['title' => 'Админка - Редактирование страницы'])
+
+@section('content')
+
+@endsection
diff --git a/resources/views/admin/pages/form.blade.php b/resources/views/admin/pages/form.blade.php
new file mode 100644
index 0000000..3d1b9ea
--- /dev/null
+++ b/resources/views/admin/pages/form.blade.php
@@ -0,0 +1,82 @@
+@csrf
+
+@isset($page)
+ @method('PUT')
+@endisset
+
+
diff --git a/resources/views/admin/pages/index.blade.php b/resources/views/admin/pages/index.blade.php
new file mode 100644
index 0000000..aea947b
--- /dev/null
+++ b/resources/views/admin/pages/index.blade.php
@@ -0,0 +1,90 @@
+@extends('layout.admin', ['title' => 'Админка - Страницы сайта'])
+
+@section('script')
+
+@endsection
+
+@section('search')
+
+@endsection
+
+@section('content')
+
+
+ Добавить страницу
+
+
+
+
+
+
+
+
+ № |
+ Название страницы |
+ Адрес |
+ Дата создания |
+ Редактировать |
+
+
+
+ @foreach($pages as $page)
+
+
+ {{$page->id}}
+ |
+
+ {{$page->name}}
+ |
+
+ {{ action([\App\Http\Controllers\PagesController::class, 'pages'], ['slug' => $page->slug]) }}
+ |
+
+ {{$page->created_at}}
+ |
+
+
+ |
+
+ @endforeach
+
+
+
+
+
+ =$pages->appends($_GET)->links('admin.pagginate'); ?>
+
+
+@endsection
diff --git a/resources/views/admin/users/roles/index.blade.php b/resources/views/admin/users/roles/index.blade.php
index 764135d..7b65644 100644
--- a/resources/views/admin/users/roles/index.blade.php
+++ b/resources/views/admin/users/roles/index.blade.php
@@ -43,7 +43,7 @@
@endsection
@section('search')
-
+
@endsection
@section('content')
diff --git a/routes/web.php b/routes/web.php
index fc2316c..c972ec5 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -181,8 +181,20 @@ Route::group([
// кабинет - редактор seo-сайта
Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo');
+
// кабинет - редактор страниц
Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages');
+ // кабинет - добавление страницы
+ Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page');
+ // кабинет - сохранение формы страницы
+ Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store');
+ // кабинет - редактирование форма страницы
+ Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page');
+ // кабинет - сохранение редактированной формы страницы
+ Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page');
+ // кабинет - удаление страницы
+ Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page');
+
// кабинет - реклама сайта
Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames');