diff --git a/app/Classes/LikesClass.php b/app/Classes/LikesClass.php index d89d8ac..376d8ec 100644 --- a/app/Classes/LikesClass.php +++ b/app/Classes/LikesClass.php @@ -31,7 +31,7 @@ class LikesClass } public static function get_status_vacancy(Ad_employer $ad_employer) { - $isVacancyLiked = Like_worker::query() + $isVacancyLiked = Like_vacancy::query() ->where('code_record', $ad_employer->id) ->where('user_id', Auth::user()?->id) ->exists(); diff --git a/app/Http/Controllers/Admin/UsersController.php b/app/Http/Controllers/Admin/UsersController.php index 98da7ff..ab7e361 100644 --- a/app/Http/Controllers/Admin/UsersController.php +++ b/app/Http/Controllers/Admin/UsersController.php @@ -80,8 +80,7 @@ class UsersController extends Controller } public function add_store_bd(BaseUserRequest $request) { - $params = $request->all(); - $positions_work = json_encode($request->input('positions_work', [])); + $params = $request->all(); if ($request->has('file')) { $params['file'] = $request->file('file')->store('basedata', 'public'); @@ -92,10 +91,10 @@ class UsersController extends Controller } $user = User::create($params); - $user_id = $user->id; $worker = new Worker(); - $worker->positions_work = $positions_work; - $worker->user_id = $user_id; + $worker->positions_work = isset($params['positions_work']) ? json_encode($params['positions_work']) : []; + $worker->user_id = $user->id; + $worker->comment = isset($params['comment']) ? $params['comment'] : null; $worker->save(); return redirect()->route('admin.basedata'); @@ -126,11 +125,13 @@ class UsersController extends Controller if (isset($user->workers[0]->id)) { $worker = Worker::find($user->workers[0]->id); $worker->positions_work = $positions_work; + $worker->comment = isset($params['comment']) ? $params['comment'] : null; $worker->save(); } else { $worker = new Worker(); $worker->user_id = $user->id; $worker->positions_work = $positions_work; + $worker->comment = isset($params['comment']) ? $params['comment'] : null; $worker->save(); } diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index 79a379f..10e5ac2 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -571,7 +571,7 @@ class EmployerController extends Controller $users = $users->Baseuser()-> orderByDesc(Worker::select('created_at')->whereColumn('workers.user_id', 'users.id')); $count_users = $users; - $users = $users->paginate(5); + $users = $users->paginate(10); $export_options = DbExportColumns::toArray(); diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index bd69aa6..c3f244d 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -247,7 +247,8 @@ class WorkerController extends Controller $status_work = WorkerStatuses::getWorkerStatuses(); $infoblocks = infobloks::query()->get(); - //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); + //dd($Query[0]); + return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); $pdf = PDF::loadView('layout.pdf', [ 'Query' => $Query, 'status_work' => $status_work, @@ -725,8 +726,10 @@ class WorkerController extends Controller // Вакансии избранные public function colorado(Request $request) { - $IP_address = RusDate::ip_addr_client(); - $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); + $Arr = Like_vacancy::Query() + ->select('code_record') + ->where('user_id', Auth::user()->id) + ->get(); if ($Arr->count()) { $A = Array(); diff --git a/app/Models/Worker.php b/app/Models/Worker.php index d501722..5f812c0 100644 --- a/app/Models/Worker.php +++ b/app/Models/Worker.php @@ -55,7 +55,8 @@ class Worker extends Model 'visa_available', 'tanker_documents_available', 'confirmation_work_for_vvp', - 'military_id_available' + 'military_id_available', + 'comment' ]; /** @@ -113,7 +114,12 @@ class Worker extends Model //Связь Работника с инфоблоками (0-0 - 0-0) public function infobloks() { - return $this->belongsToMany(infobloks::class,'dop_info', 'worker_id', 'infoblok_id'); + return $this->belongsToMany( + infobloks::class, + 'dop_info', + 'worker_id', + 'infoblok_id' + )->withPivot('status'); } //Связи Работника с дополнительными diff --git a/database/migrations/2024_10_07_073601_add_comment_to_workers_table.php b/database/migrations/2024_10_07_073601_add_comment_to_workers_table.php new file mode 100644 index 0000000..e8e9ba0 --- /dev/null +++ b/database/migrations/2024_10_07_073601_add_comment_to_workers_table.php @@ -0,0 +1,32 @@ +string('comment')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('workers', function (Blueprint $table) { + $table->dropColumn('comment'); + }); + } +}; diff --git a/resources/views/admin/users/form.blade.php b/resources/views/admin/users/form.blade.php index d40c44f..a79be1d 100644 --- a/resources/views/admin/users/form.blade.php +++ b/resources/views/admin/users/form.blade.php @@ -101,6 +101,19 @@

+ +