Commit c43fb80f6f267e367675c992381941d69a5c88a1
Exists in
master
uncommited files
Showing 3 changed files Side-by-side Diff
app/Http/Controllers/Admin/EmployersController.php
... | ... | @@ -12,16 +12,12 @@ use App\Models\Flot; |
12 | 12 | use App\Models\Static_ad; |
13 | 13 | use App\Models\User; |
14 | 14 | use Illuminate\Http\Request; |
15 | -use Illuminate\Support\Facades\DB; | |
16 | 15 | use Illuminate\Support\Facades\Storage; |
17 | 16 | use Illuminate\Support\Facades\Validator; |
18 | 17 | |
19 | 18 | class EmployersController extends Controller |
20 | 19 | { |
21 | 20 | public function index(Request $request) { |
22 | - //$all_employer = User::where('is_worker', '0')->count(); | |
23 | - $all_public = -1; | |
24 | - $all_status = -1; | |
25 | 21 | if ($request->ajax()) { |
26 | 22 | $user = User::find($request->id); |
27 | 23 | $request->offsetUnset('id'); |
... | ... | @@ -58,30 +54,25 @@ class EmployersController extends Controller |
58 | 54 | if (isset($request->find)) { |
59 | 55 | $find_key = $request->find; |
60 | 56 | $users = $users->where(function($query) use($find_key) { |
61 | - $query->Where('users.name', 'LIKE', "%$find_key%") | |
57 | + $query->where('users.name', 'LIKE', "%$find_key%") | |
62 | 58 | ->orWhere('emp.email', 'LIKE', "%$find_key%") |
63 | - ->orWhere('emp.telephone', 'LIKE', "%$find_key%"); | |
59 | + ->orWhere('emp.telephone', 'LIKE', "%$find_key%") | |
60 | + ->orWhere('emp.name_company', 'LIKE', "%$find_key%") | |
61 | + ; | |
64 | 62 | }); |
65 | 63 | } |
66 | 64 | |
67 | - //DB::enableQueryLog(); | |
68 | 65 | $all_current = $users->count(); |
69 | 66 | $users = $users->paginate(15); |
70 | - //dd(DB::getQueryLog()); | |
71 | 67 | |
72 | 68 | $select_category = CategoryEmp::query()->active()->get(); |
73 | 69 | |
74 | 70 | if ($request->ajax()) { |
75 | 71 | return view('admin.employer.index_ajax', compact('users')); |
76 | 72 | } else { |
77 | - return view('admin.employer.index', compact('users', | |
78 | - 'find_key', | |
79 | - 'find_cat', | |
80 | - 'all_employer', | |
81 | - 'all_public', | |
82 | - 'all_status', | |
83 | - 'all_current', | |
84 | - 'select_category')); | |
73 | + return view('admin.employer.index', compact('users', 'find_key', 'find_cat', 'all_employer', | |
74 | + 'all_public', 'all_status', 'all_current', 'select_category' | |
75 | + )); | |
85 | 76 | } |
86 | 77 | } |
87 | 78 |
app/Http/Controllers/MainController.php
... | ... | @@ -39,39 +39,9 @@ class MainController extends Controller |
39 | 39 | ->GroupBy('categories.id') |
40 | 40 | ->get(); |
41 | 41 | |
42 | - //$Position = Category::query()->where('is_remove', '=', '0')->get(); | |
43 | 42 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> |
44 | 43 | where('is_bd', '=', '0')->orderBy('name')->get(); |
45 | 44 | |
46 | - /*$BigFlot = Array(); | |
47 | - foreach ($Position as $position) { | |
48 | - $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | |
49 | - orderBy('job_titles.sort')-> | |
50 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
51 | - where('position_ship', "$position->name")-> | |
52 | - groupby('job_title_id','position_ship')-> | |
53 | - get(); | |
54 | - } | |
55 | - $BigFlot = Array(); | |
56 | - foreach ($Position as $position) { | |
57 | - $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { | |
58 | - $query->OrderBy('sort'); | |
59 | - }])->whereHas('job_title', function ($query) use ($position) { | |
60 | - $query->where('position_id', $position->id); | |
61 | - })-> | |
62 | - distinct('job_title_id')-> | |
63 | - get(); | |
64 | - }*/ | |
65 | - /*$BigFlot = Array(); | |
66 | - foreach ($Position as $position) { | |
67 | - $BigFlot[$position->id] = DB::table('ad_jobs')-> | |
68 | - selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> | |
69 | - orderByDesc('job_titles.sort')-> | |
70 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
71 | - where('job_titles.position_id', $position->id)-> | |
72 | - groupby('job_title_id')-> | |
73 | - get(); | |
74 | - }*/ | |
75 | 45 | $Data = DB::table('job_titles')-> |
76 | 46 | 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')-> |
77 | 47 | where('categories.is_remove', '=', '0')-> |
... | ... | @@ -177,36 +147,6 @@ class MainController extends Controller |
177 | 147 | |
178 | 148 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); |
179 | 149 | |
180 | - //$Position = Category::query()->where('is_remove', '=', '0')->get(); | |
181 | - | |
182 | - /*$BigFlot = Array(); | |
183 | - foreach ($Position as $position) { | |
184 | - $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | |
185 | - orderBy('job_titles.sort')-> | |
186 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
187 | - where('position_ship', "$position->name"); | |
188 | - if (($request->has('job')) && ($request->get('job') > 0)) { | |
189 | - $War_flot = $War_flot->where('job_title_id', $request->get('job')); | |
190 | - } | |
191 | - $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); | |
192 | - $BigFlot[] = $War_flot; | |
193 | - }*/ | |
194 | - /* | |
195 | - $BigFlot = Array(); | |
196 | - foreach ($Position as $position) { | |
197 | - $WarFlot = DB::table('ad_jobs')-> | |
198 | - selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> | |
199 | - orderByDesc('job_titles.sort')-> | |
200 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
201 | - where('job_titles.position_id', $position->id); | |
202 | - if (($request->has('job')) && ($request->get('job') > 0)) { | |
203 | - $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); | |
204 | - } | |
205 | - $WarFlot = $WarFlot->groupby('job_title_id')->get(); | |
206 | - $BigFlot[] = $WarFlot; | |
207 | - } | |
208 | - */ | |
209 | - | |
210 | 150 | $Data = DB::table('job_titles')-> |
211 | 151 | 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')-> |
212 | 152 | where('categories.is_remove', '=', '0')-> |
... | ... | @@ -282,7 +222,7 @@ class MainController extends Controller |
282 | 222 | |
283 | 223 | $Query_count = $Query->count(); |
284 | 224 | |
285 | - $Query = $Query->OrderByDesc('updated_at')->paginate(3); | |
225 | + $Query = $Query->OrderByDesc('updated_at')->paginate(10); | |
286 | 226 | |
287 | 227 | $Reclama = reclame::query()->get(); |
288 | 228 |
resources/views/index.blade.php
... | ... | @@ -21,29 +21,25 @@ |
21 | 21 | <div>Тысячи соискателей увидят Ваше объявление</div> |
22 | 22 | <div>Десятки компаний выкладывают объявления каждый день</div> |
23 | 23 | </div> |
24 | - <form class="search work__form" action="{{ route('search_vacancies') }}" method="GET"> | |
25 | - <input type="search" id="search" name="search" class="input" placeholder="Желаемая должность" required> | |
26 | - <!--<div class="select select_search thing__select"> | |
24 | + <form class="work__form width100 flex" action="{{ route('vacancies') }}" method="GET"> | |
25 | + | |
26 | + <div class="select select_search width100"> | |
27 | 27 | <div class="select__icon"> |
28 | 28 | <svg> |
29 | - <use xlink:href=" asset('images/sprite.svg#search') }}"></use> | |
29 | + <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | |
30 | 30 | </svg> |
31 | 31 | </div> |
32 | - <select class="js-select2 jobs" id="search" name="search"> | |
32 | + <select class="js-select2 jobs" id="job" name="job"> | |
33 | 33 | <option value="0">Выберите должность</option> |
34 | - if ($Job_title->count()) | |
35 | - foreach($Job_title as $JT) | |
36 | - <option value=" $JT->id }}" if ((isset($_GET['job'])) && ($_GET['job'] == $JT->id)) selected endif> $JT->name }}</option> | |
37 | - endforeach | |
38 | - endif | |
34 | + @if ($Job_title->count()) | |
35 | + @foreach($Job_title as $JT) | |
36 | + <option value="{{ $JT->id }}" @if ((isset($_GET['job'])) && ($_GET['job'] == $JT->id)) selected @endif>{{ $JT->name }}</option> | |
37 | + @endforeach | |
38 | + @endif | |
39 | 39 | </select> |
40 | - </div>--> | |
41 | - <button type="submit" class="button button_light">Посмотреть вакансии</button> | |
42 | - <span> | |
43 | - <svg> | |
44 | - <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | |
45 | - </svg> | |
46 | - </span> | |
40 | + </div> | |
41 | + | |
42 | + <button type="submit" class="button button_light" style="height: 50px;">Посмотреть вакансии</button> | |
47 | 43 | </form> |
48 | 44 | @guest |
49 | 45 | <a data-fancybox data-src="#question2" data-options='{"touch":false,"autoFocus":false}' class="button work__search">Я ищу сотрудника</a> |