From 0ea9852237693bc176370331b95f3c1b5a51994c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=20=D0=9B=D0=B0=D1=80?= =?UTF-8?q?=D0=B8=D0=BE=D0=BD=D0=BE=D0=B2?= Date: Tue, 14 May 2024 21:16:57 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=BC=D0=B8=D1=82=20=D0=BF=D0=BE?= =?UTF-8?q?=20=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0=D0=BC=20=D0=B8=20=D0?= =?UTF-8?q?=BF=D0=B5=D1=80=D0=B5=D0=BF=D0=B8=D1=81=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/EmployerController.php | 7 ++++-- app/Http/Controllers/MainController.php | 2 +- app/Http/Controllers/WorkerController.php | 15 ++++++----- app/Models/ResponseWork.php | 2 ++ app/Models/Worker.php | 4 +++ resources/views/employers/dialog.blade.php | 2 ++ resources/views/modals/send_worker_new.blade.php | 3 +++ resources/views/worker.blade.php | 29 ++++++++++++++++++++++ resources/views/workers/cabinet.blade.php | 2 +- resources/views/workers/messages.blade.php | 2 +- 10 files changed, 57 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index 8dec272..42eecd3 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -348,7 +348,6 @@ class EmployerController extends Controller with('user_to')->where('user_id', $user_id)-> OrderByDesc('created_at'); - $count_input = $messages_input->count(); $count_output = $messages_output->count(); @@ -534,6 +533,8 @@ class EmployerController extends Controller $params = $request->all(); $user1 = $params['user_id']; $user2 = $params['to_user_id']; + $id_vacancy = $params['ad_employer_id']; + $ad_name = $params['ad_name']; $rules = [ 'text' => 'required|min:1|max:150000', @@ -563,7 +564,9 @@ class EmployerController extends Controller $params['file'] = $request->file('file')->store("messages", 'public'); } Message::create($params); - return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); + //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); + return redirect()->route('employer.dialog', + ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); } } diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index eea39af..cf80934 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -94,7 +94,7 @@ class MainController extends Controller whereHas('employer', function ($query) { $query->where('status_hidden', '=', '0'); })-> - orderBy('id')->limit(8)->get(); + 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')); } diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index 4398472..05086c2 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -166,7 +166,7 @@ class WorkerController extends Controller $status_work = $this->status_work; $Query = Worker::query()->with('users')->with('job_titles') ->with('place_worker')->with('sertificate')->with('prev_company') - ->with('infobloks'); + ->with('infobloks')->with('response'); $Query = $Query->where('id', '=', $worker->id); $Query = $Query->get(); @@ -187,9 +187,10 @@ class WorkerController extends Controller $status = $crt->save(); } $stat = Static_worker::query()->where('year_month', '=', $get_date) - ->where('user_id', '=', $worker->id) + ->where('user_id', '=', $worker->user_id) ->get(); - return view('worker', compact('Query', 'status_work', 'idiot')); + + return view('worker', compact('Query', 'status_work', 'idiot', 'stat')); } // скачать анкету соискателя @@ -712,14 +713,16 @@ class WorkerController extends Controller where('id', $user2->id)->first(); } - $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { + $Messages = Message::query()-> + //with('response')-> + where(function($query) use ($user1, $user2) { $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); })->orWhere(function($query) use ($user1, $user2) { $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); })->OrderBy('created_at')->get(); $id_vac = null; - foreach ($Messages as $it) { + /*foreach ($Messages as $it) { if (isset($it->response)) { foreach ($it->response as $r) { if (isset($r->ad_employer_id)) { @@ -729,7 +732,7 @@ class WorkerController extends Controller } } if (!is_null($id_vac)) break; - } + }*/ $ad_employer = null; if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); diff --git a/app/Models/ResponseWork.php b/app/Models/ResponseWork.php index 1671a83..b65d00c 100644 --- a/app/Models/ResponseWork.php +++ b/app/Models/ResponseWork.php @@ -4,6 +4,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class ResponseWork extends Model { @@ -14,4 +15,5 @@ class ResponseWork extends Model 'stars', 'message' ]; + } diff --git a/app/Models/Worker.php b/app/Models/Worker.php index a11bd95..cc96210 100644 --- a/app/Models/Worker.php +++ b/app/Models/Worker.php @@ -89,4 +89,8 @@ class Worker extends Model return $this->hasMany(Dop_info::class, 'worker_id'); } + public function response() { + return $this->hasMany(ResponseWork::class); + } + } diff --git a/resources/views/employers/dialog.blade.php b/resources/views/employers/dialog.blade.php index 6774715..81a976e 100644 --- a/resources/views/employers/dialog.blade.php +++ b/resources/views/employers/dialog.blade.php @@ -182,6 +182,8 @@ + +