Commit 4c2bb426124ae9b5314def5ccf22fa525952c0cd

Authored by Андрей Ларионов
1 parent 2be890eeab

небольшая поправочка по категориям специальностях

Showing 1 changed file with 6 additions and 3 deletions Side-by-side Diff

app/Http/Controllers/MainController.php
... ... @@ -72,6 +72,8 @@ class MainController extends Controller
72 72 }*/
73 73 $Data = DB::table('job_titles')->
74 74 selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')->
  75 + where('categories.is_remove', '=', '0')->
  76 + where('job_titles.is_remove', '=', '0')->
75 77 leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')->
76 78 join('categories', 'categories.id', '=', 'job_titles.position_id')->
77 79 groupBy('job_titles.id')->orderByDesc('job_titles.position_id')->
... ... @@ -81,8 +83,7 @@ class MainController extends Controller
81 83 $name_cat = '';
82 84 foreach ($Data as $it) {
83 85 $it_arr = (array)$it;
84   - if ($name_cat != $it_arr['catname'])
85   - $name_cat = $it_arr['catname'];
  86 + if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname'];
86 87 $Main_Job[$name_cat][] = $it_arr;
87 88 }
88 89  
... ... @@ -190,7 +191,9 @@ class MainController extends Controller
190 191 */
191 192  
192 193 $Data = DB::table('job_titles')->
193   - selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat');
  194 + selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')->
  195 + where('categories.is_remove', '=', '0')->
  196 + where('job_titles.is_remove', '=', '0');
194 197 if (($request->has('job')) && ($request->get('job') > 0)) {
195 198 $Data = $Data->where('job_title_id', $request->get('job'));
196 199 }