diff --git a/app/Http/Controllers/Admin/Ad_EmployersController.php b/app/Http/Controllers/Admin/Ad_EmployersController.php index 1675f31..c5c1158 100644 --- a/app/Http/Controllers/Admin/Ad_EmployersController.php +++ b/app/Http/Controllers/Admin/Ad_EmployersController.php @@ -4,8 +4,10 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\Ad_employer; +use App\Models\Employer; use App\Models\Job_title; use App\Models\User; +use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Validator; @@ -20,11 +22,23 @@ class Ad_EmployersController extends Controller public function index(Request $request) { $title = 'Админка - Вакансии работодателей'; - $ad_employers = Ad_employer::with('employer')->with('jobs') - ->where('is_remove', '0')->paginate(15); + if ($request->ajax()) { + $params = $request->all(); + foreach ($params['data'] as $item) { + $emp = Ad_employer::find($item); + $emp->updated_at = Carbon::now(); + $emp->save(); + } + } - return view('admin.ad_employers.index', compact('ad_employers', 'title')); + $ad_employers = Ad_employer::with('employer')->with('jobs') + ->where('is_remove', '0')->OrderBy('updated_at', 'desc')->paginate(15); + if ($request->ajax()) { + return view('admin.ad_employers.index_ajax', compact('ad_employers', 'params')); + } else { + return view('admin.ad_employers.index', compact('ad_employers', 'title')); + } } /** diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php new file mode 100644 index 0000000..6a5dead --- /dev/null +++ b/app/Http/Controllers/WorkerController.php @@ -0,0 +1,40 @@ +where('year_month', '=', $get_date) + ->where('user_id', '=', $worker->users->id) + ->get(); + + if ($c->count() > 0) { + $upd = Static_worker::find($c[0]->id); + $upd->lookin = $upd->lookin + 1; + $upd->save(); + } else { + $crt = new Static_worker(); + $crt->lookin = 1; + $crt->year_month = $get_date; + $crt->user_id = $worker->user_id; + $crt->save(); + } + + $stat = Static_worker::query()->where('year_month', '=', $get_date) + ->where('user_id', '=', $worker->users->id) + ->get(); + + return view('public.workers.profile', compact('worker', 'stat')); + } +} diff --git a/resources/views/admin/ad_employers/index.blade.php b/resources/views/admin/ad_employers/index.blade.php index a2158fe..bdf6fe4 100644 --- a/resources/views/admin/ad_employers/index.blade.php +++ b/resources/views/admin/ad_employers/index.blade.php @@ -1,6 +1,40 @@ @extends('layout.admin', ['title' => 'Админка - Вакансии']) @section('script') + @endsection @section('search') @@ -8,6 +42,9 @@ @endsection @section('content') +
№ | -Название объявления | -Название компании | -Должности | -Избранные | -Срочные | -Статус | -Дата создан. | -Дата изменен. | -Изменить | ++ | № | +Название объявления | +Название компании | +Должности | +Избранные | +Срочные | +Статус | +Дата создан. | +Дата изменен. | +Изменить | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | + + | +{{$ad->id}} | -+ | {{$ad->name}} | -+ | {{$ad->employer->name_company}} | -+ |
@if ($ad->jobs->count())
@@ -59,7 +100,7 @@
|
- + | @if ($ad->favorite_vacancy==1) Да @@ -71,7 +112,7 @@ @endif | -+ | @if ($ad->sroch_vacancy==1) Да @@ -83,16 +124,19 @@ @endif | -+ | {{ $ad->status }} | -+ + | {{ date('d.m.Y', strtotime($ad->created_at)) }} | -+ + | {{ date('d.m.Y', strtotime($ad->updated_at)) }} | -+ + |
Изменить
diff --git a/resources/views/admin/ad_employers/index_ajax.blade.php b/resources/views/admin/ad_employers/index_ajax.blade.php
new file mode 100644
index 0000000..70140ef
--- /dev/null
+++ b/resources/views/admin/ad_employers/index_ajax.blade.php
@@ -0,0 +1,105 @@
+
+
+
+
+ =$ad_employers->appends($_GET)->links('admin.pagginate'); ?>
+
+
diff --git a/resources/views/public/workers/profile.blade.php b/resources/views/public/workers/profile.blade.php
new file mode 100644
index 0000000..0e56db4
--- /dev/null
+++ b/resources/views/public/workers/profile.blade.php
@@ -0,0 +1,27 @@
+@extends('layouts.app', ['title' => 'Профиль пользователя - '.$worker->users->name_man.'('.$worker->users->id.')'])
+
+@section('content')
+
+
+@endsection
diff --git a/routes/web.php b/routes/web.php
index d05677f..745b3af 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -13,6 +13,7 @@ use App\Http\Controllers\Auth\ForgotPasswordController;
use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\Auth\RegisterController;
use App\Http\Controllers\CKEditorController;
+use App\Http\Controllers\WorkerController;
use App\Models\User;
use App\Http\Controllers\MainController;
use App\Http\Controllers\HomeController;
@@ -348,10 +349,15 @@ Route::group([
});
+// Инструментальные страницы
Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload');
-Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page');
-
Route::get('redis/', [PagesController::class, 'redis'])->name('redis');
Route::get('excel/', [PagesController::class, 'excel'])->name('excel');
+
+// Страницы с произвольным контентом
+Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page');
+
+// Публичные страницы соискателя
+Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page');
+
+
+
+
+
+ Профиль пользователя - {{$worker->users->name_man}}({{$worker->users->id}})
+
+
+ Имя: {{ $worker->users->name_man }} +Фамилия: {{ $worker->users->surname }} +Отчество: {{ $worker->users->surname2 }} ++ + @if (isset($stat[0])) + + Количество просмотров: {{ $stat[0]->lookin}} +Количество сообщений: {{ $stat[0]->message}} + + @endif + + |