Commit 2c676e6ce07ba89d56a629f147f45d480ed6d099
1 parent
52cd6fac15
Exists in
master
and in
1 other branch
Обновление 6
Showing 1 changed file with 2 additions and 2 deletions Inline Diff
app/Http/Controllers/Ad_jobsController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\FlotRequest; | 7 | use App\Http\Requests\FlotRequest; |
8 | use App\Http\Requests\MessagesRequiest; | 8 | use App\Http\Requests\MessagesRequiest; |
9 | use App\Http\Requests\VacancyRequestEdit; | 9 | use App\Http\Requests\VacancyRequestEdit; |
10 | use App\Http\Requests\VacansiaRequiest; | 10 | use App\Http\Requests\VacansiaRequiest; |
11 | use App\Mail\MailSotrudnichestvo; | 11 | use App\Mail\MailSotrudnichestvo; |
12 | use App\Mail\SendAllMessages; | 12 | use App\Mail\SendAllMessages; |
13 | use App\Models\Ad_employer; | 13 | use App\Models\Ad_employer; |
14 | use App\Models\Ad_jobs; | 14 | use App\Models\Ad_jobs; |
15 | use App\Models\ad_response; | 15 | use App\Models\ad_response; |
16 | use App\Models\Category; | 16 | use App\Models\Category; |
17 | use App\Models\Education; | 17 | use App\Models\Education; |
18 | use App\Models\Employer; | 18 | use App\Models\Employer; |
19 | use App\Models\employers_main; | 19 | use App\Models\employers_main; |
20 | use App\Models\Flot; | 20 | use App\Models\Flot; |
21 | use App\Models\Job_title; | 21 | use App\Models\Job_title; |
22 | use App\Models\Like_vacancy; | 22 | use App\Models\Like_vacancy; |
23 | use App\Models\Like_worker; | 23 | use App\Models\Like_worker; |
24 | use App\Models\Message; | 24 | use App\Models\Message; |
25 | use App\Models\Positions; | 25 | use App\Models\Positions; |
26 | use App\Models\Worker; | 26 | use App\Models\Worker; |
27 | use Carbon\Carbon; | 27 | use Carbon\Carbon; |
28 | use Illuminate\Auth\Events\Registered; | 28 | use Illuminate\Auth\Events\Registered; |
29 | use Illuminate\Database\Eloquent\Builder; | 29 | use Illuminate\Database\Eloquent\Builder; |
30 | use Illuminate\Database\Eloquent\Model; | 30 | use Illuminate\Database\Eloquent\Model; |
31 | use Illuminate\Foundation\Auth\User; | 31 | use Illuminate\Foundation\Auth\User; |
32 | use Illuminate\Http\Request; | 32 | use Illuminate\Http\Request; |
33 | use Illuminate\Support\Facades\Auth; | 33 | use Illuminate\Support\Facades\Auth; |
34 | use Illuminate\Support\Facades\Hash; | 34 | use Illuminate\Support\Facades\Hash; |
35 | use Illuminate\Support\Facades\Mail; | 35 | use Illuminate\Support\Facades\Mail; |
36 | use Illuminate\Support\Facades\Storage; | 36 | use Illuminate\Support\Facades\Storage; |
37 | use App\Models\User as User_Model; | 37 | use App\Models\User as User_Model; |
38 | use Illuminate\Support\Facades\Validator; | 38 | use Illuminate\Support\Facades\Validator; |
39 | 39 | ||
40 | class Ad_jobsController extends Controller | 40 | class Ad_jobsController extends Controller |
41 | { | 41 | { |
42 | 42 | ||
43 | public function add_job_in_vac(Request $request, Ad_employer $ad_employer) { | 43 | public function add_job_in_vac(Request $request, Ad_employer $ad_employer) { |
44 | $id = Auth()->user()->id; | 44 | $id = Auth()->user()->id; |
45 | 45 | ||
46 | $Positions = Category::query()->get(); | 46 | $Positions = Category::query()->active()->get(); |
47 | if ($Positions->count()) { | 47 | if ($Positions->count()) { |
48 | $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); | 48 | $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); |
49 | } else { | 49 | } else { |
50 | $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); | 50 | $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); |
51 | } | 51 | } |
52 | $categories = Category::query()->get(); | 52 | $categories = Category::query()->get(); |
53 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 53 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
54 | where('user_id', $id)->first(); | 54 | where('user_id', $id)->first(); |
55 | 55 | ||
56 | return view('employers.add_ad_jobs', compact('ad_employer', | 56 | return view('employers.add_ad_jobs', compact('ad_employer', |
57 | 'Positions', 'categories', 'jobs', | 57 | 'Positions', 'categories', 'jobs', |
58 | 'Employer')); | 58 | 'Employer')); |
59 | } | 59 | } |
60 | 60 | ||
61 | public function add_job_in_vac_save(Request $request) { | 61 | public function add_job_in_vac_save(Request $request) { |
62 | $params = $request->all(); | 62 | $params = $request->all(); |
63 | 63 | ||
64 | Ad_jobs::create($params); | 64 | Ad_jobs::create($params); |
65 | return redirect()->route('employer.vacancy_list'); | 65 | return redirect()->route('employer.vacancy_list'); |
66 | } | 66 | } |
67 | 67 | ||
68 | public function edit_job_in_vac(Ad_jobs $ad_job, Ad_employer $ad_employer, Request $request) { | 68 | public function edit_job_in_vac(Ad_jobs $ad_job, Ad_employer $ad_employer, Request $request) { |
69 | $id = Auth()->user()->id; | 69 | $id = Auth()->user()->id; |
70 | if ($request->has('job_title_id')) | 70 | if ($request->has('job_title_id')) |
71 | $job_title_id= $request->get('job_title_id'); | 71 | $job_title_id= $request->get('job_title_id'); |
72 | else | 72 | else |
73 | $job_title_id = ''; | 73 | $job_title_id = ''; |
74 | 74 | ||
75 | $Positions = Category::query()->get(); | 75 | $Positions = Category::query()->active()->get(); |
76 | if ($Positions->count()) { | 76 | if ($Positions->count()) { |
77 | $jobs123 = Job_title::query()->OrderBy('name')->where('position_id', $ad_job->job_title->position_id )->get(); | 77 | $jobs123 = Job_title::query()->OrderBy('name')->where('position_id', $ad_job->job_title->position_id )->get(); |
78 | } else { | 78 | } else { |
79 | $jobs123 = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); | 79 | $jobs123 = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); |
80 | } | 80 | } |
81 | 81 | ||
82 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 82 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
83 | where('user_id', $id)->first(); | 83 | where('user_id', $id)->first(); |
84 | return view('employers.edit_ad_jobs', compact('ad_job', | 84 | return view('employers.edit_ad_jobs', compact('ad_job', |
85 | 'Positions', | 85 | 'Positions', |
86 | 'Employer','jobs123', 'ad_employer', 'job_title_id')); | 86 | 'Employer','jobs123', 'ad_employer', 'job_title_id')); |
87 | } | 87 | } |
88 | 88 | ||
89 | public function edit_job_in_vac_save(Request $request, Ad_jobs $ad_job) { | 89 | public function edit_job_in_vac_save(Request $request, Ad_jobs $ad_job) { |
90 | $params = $request->all(); | 90 | $params = $request->all(); |
91 | 91 | ||
92 | $ad_job->update($params); | 92 | $ad_job->update($params); |
93 | 93 | ||
94 | return redirect()->route('employer.vacancy_list'); | 94 | return redirect()->route('employer.vacancy_list'); |
95 | } | 95 | } |
96 | 96 | ||
97 | public function delete_job_in_vac(Ad_jobs $ad_job) { | 97 | public function delete_job_in_vac(Ad_jobs $ad_job) { |
98 | $ad_job->delete(); | 98 | $ad_job->delete(); |
99 | return redirect()->route('employer.vacancy_list'); | 99 | return redirect()->route('employer.vacancy_list'); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 |