From f7e643c97f905b23672dbc68240e114d2b38f931 Mon Sep 17 00:00:00 2001 From: anazaryan Date: Wed, 13 Nov 2024 14:33:02 +0400 Subject: [PATCH] fix fields --- app/Http/Controllers/WorkerController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index 0079d94..b2c2739 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -304,7 +304,9 @@ 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 + $selectFields = implode(',', $columns); + + $users = DB::select("SELECT $selectFields 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)), '$')) -- 1.7.10.4