From 468369903bf7b3341e4e8b92fe9568a190762aae 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: Thu, 25 Apr 2024 15:11:40 +0700 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0?= =?UTF-8?q?=B5=20=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82=D1=83=D1=80=D1=8B=20=D0?= =?UTF-8?q?=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0=20=D0=BF=D0=BE=20=D0=B2=D0?= =?UTF-8?q?=B0=D0=BA=D0=B0=D0=BD=D1=81=D0=B8=D1=8F=D0=BC=20-=20=D0=BA=D0=B0=D0?= =?UTF-8?q?=B1=D0=B8=D0=BD=D0=B5=D1=82=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B4=D0=B0=D1=82=D0=B5=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/EmployerController.php | 34 +++--- app/Http/Controllers/WorkerController.php | 3 - app/Models/Ad_employer.php | 5 + resources/views/employers/add_vacancy.blade.php | 141 +++++++++++++---------- 4 files changed, 106 insertions(+), 77 deletions(-) diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index ddbeaca..0412fb6 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -163,13 +163,12 @@ class EmployerController extends Controller $id = Auth()->user()->id; $categories = Category::query()->active()->get(); - - if ($categories->count()) { - $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', $categories[0]->id)->get(); - } else { - $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', 0)->get(); - } - + //if ($categories->count()) { + // $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', $categories[0]->id)->get(); + //} else { + // $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', 0)->get(); + //} + $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->get(); $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> WhereHas('users', function (Builder $query) use ($id) {$query->Where('id', $id); @@ -180,19 +179,22 @@ class EmployerController extends Controller // Сохранение вакансии public function cabinet_vacancy_save1(VacancyRequestEdit $request) { $params_emp = $request->all(); + $params_job["job_title_id"] = $params_emp['job_title_id']; - $params_job["min_salary"] = $params_emp['min_salary']; - $params_job["max_salary"] = $params_emp['max_salary']; - $params_job["region"] = $params_emp['region']; - $params_job["power"] = $params_emp['power']; - $params_job["sytki"] = $params_emp['sytki']; - $params_job["start"] = $params_emp['start']; - $params_job["flot"] = $params_emp['flot']; + //$params_job["min_salary"] = $params_emp['min_salary']; + //$params_job["max_salary"] = $params_emp['max_salary']; + //$params_job["region"] = $params_emp['region']; + //$params_job["power"] = $params_emp['power']; + //$params_job["sytki"] = $params_emp['sytki']; + //$params_job["start"] = $params_emp['start']; + //$params_job["flot"] = $params_emp['flot']; $params_job["description"] = $params_emp['description']; $ad_jobs = Ad_employer::create($params_emp); - $params_job['ad_employer_id'] = $ad_jobs->id; - Ad_jobs::create($params_job); + //$params_job['ad_employer_id'] = $ad_jobs->id; + //Ad_jobs::create($params_job); + $ad_jobs->jobs()->sync($request->get('job_title_id')); + return redirect()->route('employer.vacancy_list'); } diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index 7d62fee..2632877 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -278,9 +278,6 @@ class WorkerController extends Controller $persent = $persent + 5; $persent5 = 5; } - - //dd($persent1, $persent2, $persent3, $persent4, $persent5); - if ($request->has('print')) { dd($Worker); } else { diff --git a/app/Models/Ad_employer.php b/app/Models/Ad_employer.php index da6da3e..6c7de72 100644 --- a/app/Models/Ad_employer.php +++ b/app/Models/Ad_employer.php @@ -68,4 +68,9 @@ class Ad_employer extends Model public function ad_job() { return $this->hasMany(Ad_jobs::class); } + + // Связь Вакансии с должностями (0-0 - 1) + public function job_titles() { + return $this->belongsToMany(Job_title::class, 'title_workers'); + } } diff --git a/resources/views/employers/add_vacancy.blade.php b/resources/views/employers/add_vacancy.blade.php index a75d9ef..fb70021 100644 --- a/resources/views/employers/add_vacancy.blade.php +++ b/resources/views/employers/add_vacancy.blade.php @@ -122,29 +122,28 @@ @enderror - -
+
@@ -167,100 +166,126 @@
-
+ + +
+ +
+
+ - @error('job_title_id') - - {{ $message }} - - @enderror
-
+
-- 1.7.10.4