Commit 39c5c7bb72c71a2602d64f06d3b2faeaecb6865f

Authored by Андрей Ларионов
1 parent 14681d2d2d

Коммит по вакансиям - список

Showing 3 changed files with 6 additions and 8 deletions Side-by-side Diff

app/Http/Controllers/EmployerController.php
... ... @@ -163,9 +163,9 @@ class EmployerController extends Controller
163 163 $id = Auth()->user()->id;
164 164  
165 165 $categories = Category::query()->active()->get();
166   - $Positions = Category::query()->active()->get();
167   - if ($Positions->count()) {
168   - $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', $Positions[0]->id)->get();
  166 +
  167 + if ($categories->count()) {
  168 + $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', $categories[0]->id)->get();
169 169 } else {
170 170 $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', 0)->get();
171 171 }
... ... @@ -174,8 +174,7 @@ class EmployerController extends Controller
174 174 WhereHas('users',
175 175 function (Builder $query) use ($id) {$query->Where('id', $id);
176 176 })->get();
177   -
178   - return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories', 'Positions'));
  177 + return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories'));
179 178 }
180 179  
181 180 // Сохранение вакансии
app/Http/Controllers/MainController.php
... ... @@ -79,6 +79,7 @@ class MainController extends Controller
79 79 groupBy('job_titles.id')->orderByDesc('job_titles.position_id')->
80 80 orderByDesc('job_titles.sort')->get()->toArray();
81 81  
  82 +
82 83 $Main_Job = array();
83 84 $name_cat = '';
84 85 foreach ($Data as $it) {
resources/views/employers/add_vacancy.blade.php
... ... @@ -128,13 +128,11 @@
128 128 <div class="form-group__item">
129 129 <div class="select">
130 130 <select class="js-select2" name="category_id" id="category_id">
  131 + <option selected> Выберите категорию из списка</option>
131 132 @php $i = 1 @endphp
132 133 @if ($categories->count())
133 134 @foreach($categories as $j)
134   - @if ($i == 1) <option selected> Выберите категорию из списка</option>
135   - @else
136 135 <option value="{{ $j->id }}">{{ $j->name }}</option>
137   - @endif
138 136 @php $i++ @endphp
139 137 @endforeach
140 138 @endif