diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index e158da6..ad4da01 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -8,7 +8,7 @@ use Illuminate\Http\Request; class CompanyController extends Controller { public function shipping_companies(Request $request) { - $emps = Employer::query()->with('ads'); + $emps = Employer::query()->with('ads')->where('status_hidden', '=', '0'); if (($request->has('search')) && (!empty($request->get('search')))) { $search = $request->get('search'); $emps = $emps->where('name_company', 'LIKE', "%$search%"); diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index 2792d02..dfcd177 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -162,18 +162,26 @@ class EmployerController extends Controller public function cabinet_vacancie() { $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(); - //} - $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->where('is_bd', '=' , '0')->get(); - $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> - WhereHas('users', - function (Builder $query) use ($id) {$query->Where('id', $id); - })->get(); - return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories')); + if (Auth()->user()->is_public) { + $categories = Category::query()->active()->get(); + + $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->where('is_bd', '=', '0')->get(); + $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> + + WhereHas('users', + function (Builder $query) use ($id) { + $query->Where('id', $id); + })->get(); + + return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); + } else { + return redirect()->route('employer.cabinet_vacancie_danger'); + } + } + + // Форма предупреждения об оплате + public function cabinet_vacancie_danger() { + return view('employers.add_vacancy_danger'); } // Сохранение вакансии diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index 68e7bb1..d5f3c29 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -73,63 +73,76 @@ class WorkerController extends Controller // лист база резюме public function bd_resume(Request $request) { + $look = false; + $idiot = 0; if (isset(Auth()->user()->id)) { $idiot = Auth()->user()->id; - } else { - $idiot = 0; + if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) + $look = true; } - $status_work = $this->status_work; - $resumes = Worker::query()->with('users')->with('job_titles'); - $resumes = $resumes->whereHas('users', function (Builder $query) { - $query->Where('is_worker', '=', '1') - ->Where('is_bd', '=', '0'); - }); - - //dd($request->get('job')); - if (($request->has('job')) && ($request->get('job') > 0)) { - $resumes = $resumes->whereHas('job_titles', function(Builder $query) use ($request) { - $query->Where('job_titles.id', $request->get('job')); + if ($look) { + $status_work = $this->status_work; + $resumes = Worker::query()->with('users')->with('job_titles'); + $resumes = $resumes->whereHas('users', function (Builder $query) { + $query->Where('is_worker', '=', '1') + ->Where('is_bd', '=', '0'); }); - } - $Job_title = Job_title::query()->get(); - - if ($request->get('sort')) { - $sort = $request->get('sort'); - switch ($sort) { - case 'name_up': - $resumes = $resumes->orderBy(User::select('surname') - ->whereColumn('Workers.user_id', 'users.id') - ); - break; - case 'name_down': - $resumes = $resumes->orderByDesc(User::select('surname') - ->whereColumn('Workers.user_id', 'users.id') - ); - break; - case 'created_at_up': $resumes = $resumes->OrderBy('created_at')->orderBy('id'); break; - case 'created_at_down': $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); break; - case 'default': $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; - default: $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; + //dd($request->get('job')); + if (($request->has('job')) && ($request->get('job') > 0)) { + $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { + $query->Where('job_titles.id', $request->get('job')); + }); } - } - $res_count = $resumes->count(); - //$resumes = $resumes->get(); + $Job_title = Job_title::query()->get(); - $resumes = $resumes->paginate(4); - if ($request->ajax()) { - // Условия обставлены - if ($request->has('block') && ($request->get('block') == 1)) { - return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); + if ($request->get('sort')) { + $sort = $request->get('sort'); + switch ($sort) { + case 'name_up': + $resumes = $resumes->orderBy(User::select('surname') + ->whereColumn('Workers.user_id', 'users.id') + ); + break; + case 'name_down': + $resumes = $resumes->orderByDesc(User::select('surname') + ->whereColumn('Workers.user_id', 'users.id') + ); + break; + case 'created_at_up': + $resumes = $resumes->OrderBy('created_at')->orderBy('id'); + break; + case 'created_at_down': + $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); + break; + case 'default': + $resumes = $resumes->orderBy('id')->orderby('updated_at'); + break; + default: + $resumes = $resumes->orderBy('id')->orderby('updated_at'); + break; + } } - if ($request->has('block') && ($request->get('block') == 2)) { - return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); + $res_count = $resumes->count(); + //$resumes = $resumes->get(); + $resumes = $resumes->paginate(4); + if ($request->ajax()) { + // Условия обставлены + if ($request->has('block') && ($request->get('block') == 1)) { + return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); + } + + if ($request->has('block') && ($request->get('block') == 2)) { + return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); + } + } else { + return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); } } else { - return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); + return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); } } diff --git a/resources/views/ajax/resume_1.blade.php b/resources/views/ajax/resume_1.blade.php index 5e21cda..5cd9cb4 100644 --- a/resources/views/ajax/resume_1.blade.php +++ b/resources/views/ajax/resume_1.blade.php @@ -1,62 +1,79 @@ -@if ($resumes->count()) - @foreach ($resumes as $res) -