Commit 1b48ee4fb1c452f0eb72f33cacb849e2d57d4c0d
1 parent
eff54ff661
Exists in
master
export fix
Showing 1 changed file with 5 additions and 10 deletions Side-by-side Diff
app/Http/Controllers/WorkerController.php
... | ... | @@ -304,16 +304,11 @@ class WorkerController extends Controller |
304 | 304 | )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '') |
305 | 305 | );*/ |
306 | 306 | |
307 | - $users = DB::select( | |
308 | - "select `job_titles`.`name`, `users`.`surname`, `users`.`name_man`, `users`.`surname2`, `users`.`email`, `users`.`telephone` | |
309 | - from users | |
310 | - join workers on `users`.`id` = `workers`.`user_id` | |
311 | - join `job_titles` | |
312 | - where `users`.`is_bd` = 1 | |
313 | - and (`workers`.`position_work` = `job_titles`.`id` | |
314 | - or `workers`.`positions_work` | |
315 | - )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '') | |
316 | - ); | |
307 | + $users = DB::select("SELECT`job_titles`.`name`,`users`.`surname`,`users`.`name_man`,`users`.`surname2`,`users`.`email`,`users`.`telephone` FROM users | |
308 | + JOIN workers ON `users`.`id` = `workers`.`user_id` | |
309 | + JOIN job_titles ON (`workers`.`position_work` = `job_titles`.`id` | |
310 | + OR JSON_CONTAINS(`workers`.`positions_work`, JSON_QUOTE(CAST(`job_titles`.`id` AS CHAR)), '$')) | |
311 | + WHERE `users`.`is_bd` = 1 " . ((!empty($jobIds)) ? 'AND job_titles.id IN (' . implode(',', $jobIds) . ')' : '') . ""); | |
317 | 312 | |
318 | 313 | $users = collect($users); |
319 | 314 |