From 1b48ee4fb1c452f0eb72f33cacb849e2d57d4c0d Mon Sep 17 00:00:00 2001 From: anazaryan Date: Tue, 12 Nov 2024 20:21:36 +0400 Subject: [PATCH] export fix --- app/Http/Controllers/WorkerController.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index 2a9be05..0079d94 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -304,16 +304,11 @@ class WorkerController extends Controller )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '') );*/ - $users = DB::select( - "select `job_titles`.`name`, `users`.`surname`, `users`.`name_man`, `users`.`surname2`, `users`.`email`, `users`.`telephone` - from users - join workers on `users`.`id` = `workers`.`user_id` - join `job_titles` - where `users`.`is_bd` = 1 - and (`workers`.`position_work` = `job_titles`.`id` - or `workers`.`positions_work` - )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '') - ); + $users = DB::select("SELECT`job_titles`.`name`,`users`.`surname`,`users`.`name_man`,`users`.`surname2`,`users`.`email`,`users`.`telephone` FROM users + JOIN workers ON `users`.`id` = `workers`.`user_id` + JOIN job_titles ON (`workers`.`position_work` = `job_titles`.`id` + OR JSON_CONTAINS(`workers`.`positions_work`, JSON_QUOTE(CAST(`job_titles`.`id` AS CHAR)), '$')) + WHERE `users`.`is_bd` = 1 " . ((!empty($jobIds)) ? 'AND job_titles.id IN (' . implode(',', $jobIds) . ')' : '') . ""); $users = collect($users); -- 1.7.10.4