diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index ebdd0a0..c917d4e 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -41,10 +41,16 @@ class CompanyController extends Controller } public function info_company(Employer $company) { - $user_id = Auth()->user()->id; + if (isset(Auth()->user()->id)) { + $user_id = Auth()->user()->id; + } else { + $user_id = 0; + } $company = Employer::with('ads')->with('flots')->with('users') ->where('id', '=', $company->id)->get(); + $title = $company[0]->name_company; - return view('info_company', compact('company', 'user_id', 'title')); + + return view('info_company_new', compact('company', 'user_id', 'title')); } } diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 68e998f..fdd2984 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -179,6 +179,9 @@ class MainController extends Controller // Вход в личный кабинет public function input_login(Request $request) { + $params = $request->all(); + + $rules = [ 'email' => 'required|string|email', 'password' => 'required|string', @@ -199,6 +202,7 @@ class MainController extends Controller $validator = Validator::make($request->all(), $rules, $messages); + if ($validator->fails()) { return redirect()->route('index')->with('Error', "Email или пароль невалидный"); } else { @@ -260,6 +264,8 @@ class MainController extends Controller foreach ([$request->get('email')] as $recipient) { Mail::to($recipient)->send(new MailRepair($new_password)); } + return redirect()->route('index'); + } } diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index ad6ccee..35210f5 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -62,7 +62,7 @@ class WorkerController extends Controller } // лист база резюме - public function bd_resume() + public function bd_resume(Request $request) { if (isset(Auth()->user()->id)) { $idiot = Auth()->user()->id; @@ -71,17 +71,47 @@ class WorkerController extends Controller } $status_work = $this->status_work; - $resumes = Worker::query()->with('users')->with('job_titles')-> - WhereHas('users', + $resumes = Worker::query()->with('users')->with('job_titles') + ->WhereHas('users', function (Builder $query) { $query->Where('is_worker', '=', '1')-> Where('is_bd', '=', '0'); - }); + }); + + if ($request->get('sort')) { + $sort = $request->get('sort'); + switch ($sort) { + case 'name_up': + $resumes = $resumes->whereHas('users', function (Builder $query) { + $query = $query->orderBy('surname')->orderBy('id'); + }); + break; + case 'name_down': + $resumes = $resumes->whereHas('users', function (Builder $query) { + $query = $query->orderByDesc('surname')->orderby('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; + } + } $res_count = $resumes->count(); - $resumes = $resumes->paginate(5); + $resumes = $resumes->paginate(6); + if ($request->ajax()) { + // Условия обставлены + if ($request->has('block') && ($request->get('block') == 1)) { + return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); + } - return view('resume', 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')); + } } // анкета соискателя @@ -244,7 +274,7 @@ class WorkerController extends Controller if ($request->get('new_password') == $request->get('new_password2')) if ($request->get('password') !== $request->get('new_password')) { $credentials = $request->only('email', 'password'); - if (Auth::attempt($credentials)) { + if (Auth::attempt($credentials, $request->has('save_me'))) { if (!is_null($use->email_verified_at)){ @@ -322,9 +352,6 @@ class WorkerController extends Controller ] ]; - - - if ($request->get('password') !== $request->get('confirmed')){ return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); } diff --git a/resources/views/ajax/resume_1.blade.php b/resources/views/ajax/resume_1.blade.php new file mode 100644 index 0000000..4c6d481 --- /dev/null +++ b/resources/views/ajax/resume_1.blade.php @@ -0,0 +1,50 @@ +@if ($resumes->count()) + @foreach ($resumes as $res) +
{{ $company[0]->text }}
+ +Зарплата:{{ $item->min_salary }} - {{ $item->max_salary }}р + {{ $item->sytki }} суточные.
+Контракт: {{ $item->period }} мес.
+{{ $item->region }}
+{{ $item->start }}
+ {!! $item->description !!} +