Commit 24b44fa6c6833642d412c126717582bbc1db5c10

Authored by Андрей Ларионов
1 parent 6f65907209
Exists in master

майн контроллер

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  
... ... @@ -191,7 +192,9 @@ class MainController extends Controller
191 192 */
192 193  
193 194 $Data = DB::table('job_titles')->
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 + 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')->
  196 + where('categories.is_remove', '=', '0')->
  197 + where('job_titles.is_remove', '=', '0');
195 198 if (($request->has('job')) && ($request->get('job') > 0)) {
196 199 $Data = $Data->where('job_title_id', $request->get('job'));
197 200 }