Commit 6e9c6423bcf33458fa145c6c8b637b595ee7a5d0
1 parent
ad0b69c97b
Exists in
master
task-132687 tasks 82 83 84
Showing 5 changed files with 28 additions and 43 deletions Inline Diff
app/Http/Controllers/EmployerController.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\BaseUser_min_Request; | 7 | use App\Http\Requests\BaseUser_min_Request; |
8 | use App\Http\Requests\FlotRequest; | 8 | use App\Http\Requests\FlotRequest; |
9 | use App\Http\Requests\MessagesRequiest; | 9 | use App\Http\Requests\MessagesRequiest; |
10 | use App\Http\Requests\VacancyRequestEdit; | 10 | use App\Http\Requests\VacancyRequestEdit; |
11 | use App\Mail\MailCreateEmployer; | 11 | use App\Mail\MailCreateEmployer; |
12 | use App\Mail\MailSotrudnichestvo; | 12 | use App\Mail\MailSotrudnichestvo; |
13 | use App\Mail\MassSendingMessages; | 13 | use App\Mail\MassSendingMessages; |
14 | use App\Mail\SendAllMessages; | 14 | use App\Mail\SendAllMessages; |
15 | use App\Models\Ad_employer; | 15 | use App\Models\Ad_employer; |
16 | use App\Models\ad_response; | 16 | use App\Models\ad_response; |
17 | use App\Models\Category; | 17 | use App\Models\Category; |
18 | use App\Models\Chat; | 18 | use App\Models\Chat; |
19 | use App\Models\Employer; | 19 | use App\Models\Employer; |
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_worker; | 22 | use App\Models\Like_worker; |
23 | use App\Models\Message; | 23 | use App\Models\Message; |
24 | use App\Models\Worker; | 24 | use App\Models\Worker; |
25 | use App\Models\MessagesRequests; | 25 | use App\Models\MessagesRequests; |
26 | use Carbon\Carbon; | 26 | use Carbon\Carbon; |
27 | use Illuminate\Auth\Events\Registered; | 27 | use Illuminate\Auth\Events\Registered; |
28 | use Illuminate\Database\Eloquent\Builder; | 28 | use Illuminate\Database\Eloquent\Builder; |
29 | use Illuminate\Http\Request; | 29 | use Illuminate\Http\Request; |
30 | use Illuminate\Support\Facades\Auth; | 30 | use Illuminate\Support\Facades\Auth; |
31 | use Illuminate\Support\Facades\Hash; | 31 | use Illuminate\Support\Facades\Hash; |
32 | use Illuminate\Support\Facades\Log; | 32 | use Illuminate\Support\Facades\Log; |
33 | use Illuminate\Support\Facades\Mail; | 33 | use Illuminate\Support\Facades\Mail; |
34 | use Illuminate\Support\Facades\Storage; | 34 | use Illuminate\Support\Facades\Storage; |
35 | use App\Models\User as User_Model; | 35 | use App\Models\User as User_Model; |
36 | use Illuminate\Support\Facades\Validator; | 36 | use Illuminate\Support\Facades\Validator; |
37 | use App\Enums\DbExportColumns; | 37 | use App\Enums\DbExportColumns; |
38 | use Throwable; | 38 | use Throwable; |
39 | 39 | ||
40 | class EmployerController extends Controller | 40 | class EmployerController extends Controller |
41 | { | 41 | { |
42 | public function vacancie($vacancy, Request $request) { | 42 | public function vacancie($vacancy, Request $request) { |
43 | $title = 'Заголовок вакансии'; | 43 | $title = 'Заголовок вакансии'; |
44 | $Query = Ad_employer::with('jobs')-> | 44 | $Query = Ad_employer::with('jobs')-> |
45 | with('cat')-> | 45 | with('cat')-> |
46 | with('employer')-> | 46 | with('employer')-> |
47 | with('jobs_code')-> | 47 | with('jobs_code')-> |
48 | select('ad_employers.*')-> | 48 | select('ad_employers.*')-> |
49 | where('id', '=', $vacancy)->get(); | 49 | where('id', '=', $vacancy)->get(); |
50 | 50 | ||
51 | if (isset(Auth()->user()->id)) | 51 | if (isset(Auth()->user()->id)) |
52 | $uid = Auth()->user()->id; | 52 | $uid = Auth()->user()->id; |
53 | else | 53 | else |
54 | $uid = 0; | 54 | $uid = 0; |
55 | $title = $Query[0]->name; | 55 | $title = $Query[0]->name; |
56 | if ($request->ajax()) { | 56 | if ($request->ajax()) { |
57 | return view('ajax.vacance-item', compact('Query','uid')); | 57 | return view('ajax.vacance-item', compact('Query','uid')); |
58 | } else { | 58 | } else { |
59 | return view('vacance-item', compact('title', 'Query', 'uid')); | 59 | return view('vacance-item', compact('title', 'Query', 'uid')); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | public function logout() { | 63 | public function logout() { |
64 | Auth::logout(); | 64 | Auth::logout(); |
65 | return redirect()->route('index') | 65 | return redirect()->route('index') |
66 | ->with('success', 'Вы вышли из личного кабинета'); | 66 | ->with('success', 'Вы вышли из личного кабинета'); |
67 | } | 67 | } |
68 | 68 | ||
69 | public function employer_info() { | 69 | public function employer_info() { |
70 | // код юзера | 70 | // код юзера |
71 | $user_info = Auth()->user(); | 71 | $user_info = Auth()->user(); |
72 | // вьюшка для вывода данных | 72 | // вьюшка для вывода данных |
73 | return view('employers.info', compact('user_info')); | 73 | return view('employers.info', compact('user_info')); |
74 | } | 74 | } |
75 | 75 | ||
76 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { | 76 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { |
77 | // Все данные через реквест | 77 | // Все данные через реквест |
78 | $all = $request->all(); | 78 | $all = $request->all(); |
79 | unset($all['_token']); | 79 | unset($all['_token']); |
80 | // обновление | 80 | // обновление |
81 | $user->update($all); | 81 | $user->update($all); |
82 | return redirect()->route('employer.employer_info'); | 82 | return redirect()->route('employer.employer_info'); |
83 | } | 83 | } |
84 | 84 | ||
85 | public function cabinet() { | 85 | public function cabinet() { |
86 | $id = Auth()->user()->id; | 86 | $id = Auth()->user()->id; |
87 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 87 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
88 | WhereHas('users', | 88 | WhereHas('users', |
89 | function (Builder $query) use ($id) {$query->Where('id', $id); | 89 | function (Builder $query) use ($id) {$query->Where('id', $id); |
90 | })->get(); | 90 | })->get(); |
91 | return view('employers.cabinet45', compact('Employer')); | 91 | return view('employers.cabinet45', compact('Employer')); |
92 | } | 92 | } |
93 | 93 | ||
94 | public function slider_flot() { | 94 | public function slider_flot() { |
95 | $id = Auth()->user()->id; | 95 | $id = Auth()->user()->id; |
96 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 96 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
97 | WhereHas('users', | 97 | WhereHas('users', |
98 | function (Builder $query) use ($id) {$query->Where('id', $id); | 98 | function (Builder $query) use ($id) {$query->Where('id', $id); |
99 | })->get(); | 99 | })->get(); |
100 | return view('employers.fly-flot', compact('Employer')); | 100 | return view('employers.fly-flot', compact('Employer')); |
101 | } | 101 | } |
102 | 102 | ||
103 | public function cabinet_save(Employer $Employer, Request $request) { | 103 | public function cabinet_save(Employer $Employer, Request $request) { |
104 | $params = $request->all(); | 104 | $params = $request->all(); |
105 | $params['user_id'] = Auth()->user()->id; | 105 | $params['user_id'] = Auth()->user()->id; |
106 | $id = $Employer->id; | 106 | $id = $Employer->id; |
107 | 107 | ||
108 | if ($request->has('logo')) { | 108 | if ($request->has('logo')) { |
109 | if (!empty($Employer->logo)) { | 109 | if (!empty($Employer->logo)) { |
110 | Storage::delete($Employer->logo); | 110 | Storage::delete($Employer->logo); |
111 | } | 111 | } |
112 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); | 112 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); |
113 | } | 113 | } |
114 | 114 | ||
115 | $Employer->update($params); | 115 | $Employer->update($params); |
116 | 116 | ||
117 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); | 117 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); |
118 | } | 118 | } |
119 | 119 | ||
120 | public function save_add_flot(FlotRequest $request) { | 120 | public function save_add_flot(FlotRequest $request) { |
121 | // отмена | 121 | // отмена |
122 | $params = $request->all(); | 122 | $params = $request->all(); |
123 | 123 | ||
124 | if ($request->has('image')) { | 124 | if ($request->has('image')) { |
125 | $params['image'] = $request->file('image')->store("flot", 'public'); | 125 | $params['image'] = $request->file('image')->store("flot", 'public'); |
126 | } | 126 | } |
127 | Flot::create($params); | 127 | Flot::create($params); |
128 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); | 128 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); |
129 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 129 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
130 | } | 130 | } |
131 | 131 | ||
132 | public function edit_flot(Flot $Flot, Employer $Employer) { | 132 | public function edit_flot(Flot $Flot, Employer $Employer) { |
133 | return view('employers.edit-flot', compact('Flot', 'Employer')); | 133 | return view('employers.edit-flot', compact('Flot', 'Employer')); |
134 | } | 134 | } |
135 | 135 | ||
136 | public function update_flot(FlotRequest $request, Flot $Flot) { | 136 | public function update_flot(FlotRequest $request, Flot $Flot) { |
137 | $params = $request->all(); | 137 | $params = $request->all(); |
138 | 138 | ||
139 | if ($request->has('image')) { | 139 | if ($request->has('image')) { |
140 | if (!empty($flot->image)) { | 140 | if (!empty($flot->image)) { |
141 | Storage::delete($flot->image); | 141 | Storage::delete($flot->image); |
142 | } | 142 | } |
143 | $params['image'] = $request->file('image')->store("flot", 'public'); | 143 | $params['image'] = $request->file('image')->store("flot", 'public'); |
144 | } else { | 144 | } else { |
145 | if (!empty($flot->image)) $params['image'] = $flot->image; | 145 | if (!empty($flot->image)) $params['image'] = $flot->image; |
146 | } | 146 | } |
147 | 147 | ||
148 | $Flot->update($params); | 148 | $Flot->update($params); |
149 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 149 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
150 | } | 150 | } |
151 | 151 | ||
152 | public function delete_flot(Flot $Flot) { | 152 | public function delete_flot(Flot $Flot) { |
153 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); | 153 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); |
154 | 154 | ||
155 | if (isset($Flot->id)) $Flot->delete(); | 155 | if (isset($Flot->id)) $Flot->delete(); |
156 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); | 156 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); |
157 | } | 157 | } |
158 | 158 | ||
159 | // Форма добавления вакансий | 159 | // Форма добавления вакансий |
160 | public function cabinet_vacancie() { | 160 | public function cabinet_vacancie() { |
161 | $id = Auth()->user()->id; | 161 | $id = Auth()->user()->id; |
162 | 162 | ||
163 | if (Auth()->user()->is_public) { | 163 | if (Auth()->user()->is_public) { |
164 | $categories = Category::query()->active()->get(); | 164 | $categories = Category::query()->active()->get(); |
165 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 165 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
166 | where('is_remove', '=', '0')-> | 166 | where('is_remove', '=', '0')-> |
167 | where('is_bd', '=', '0')-> | 167 | where('is_bd', '=', '0')-> |
168 | get(); | 168 | get(); |
169 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 169 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
170 | WhereHas('users', | 170 | WhereHas('users', |
171 | function (Builder $query) use ($id) { | 171 | function (Builder $query) use ($id) { |
172 | $query->Where('id', $id); | 172 | $query->Where('id', $id); |
173 | })->get(); | 173 | })->get(); |
174 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); | 174 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); |
175 | } else { | 175 | } else { |
176 | return redirect()->route('employer.cabinet_vacancie_danger'); | 176 | return redirect()->route('employer.cabinet_vacancie_danger'); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | // Форма предупреждения об оплате | 180 | // Форма предупреждения об оплате |
181 | public function cabinet_vacancie_danger() { | 181 | public function cabinet_vacancie_danger() { |
182 | return view('employers.add_vacancy_danger'); | 182 | return view('employers.add_vacancy_danger'); |
183 | } | 183 | } |
184 | 184 | ||
185 | // Сохранение вакансии | 185 | // Сохранение вакансии |
186 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { | 186 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { |
187 | $params_emp = $request->all(); | 187 | $params_emp = $request->all(); |
188 | 188 | ||
189 | $params_job["job_title_id"] = $params_emp['job_title_id']; | 189 | $params_job["job_title_id"] = $params_emp['job_title_id']; |
190 | //$params_job["min_salary"] = $params_emp['min_salary']; | 190 | //$params_job["min_salary"] = $params_emp['min_salary']; |
191 | //$params_job["max_salary"] = $params_emp['max_salary']; | 191 | //$params_job["max_salary"] = $params_emp['max_salary']; |
192 | //$params_job["region"] = $params_emp['region']; | 192 | //$params_job["region"] = $params_emp['region']; |
193 | //$params_job["power"] = $params_emp['power']; | 193 | //$params_job["power"] = $params_emp['power']; |
194 | //$params_job["sytki"] = $params_emp['sytki']; | 194 | //$params_job["sytki"] = $params_emp['sytki']; |
195 | //$params_job["start"] = $params_emp['start']; | 195 | //$params_job["start"] = $params_emp['start']; |
196 | //$params_job["flot"] = $params_emp['flot']; | 196 | //$params_job["flot"] = $params_emp['flot']; |
197 | //$params_job["description"] = $params_emp['description']; | 197 | //$params_job["description"] = $params_emp['description']; |
198 | 198 | ||
199 | $ad_jobs = Ad_employer::create($params_emp); | 199 | $ad_jobs = Ad_employer::create($params_emp); |
200 | //$params_job['ad_employer_id'] = $ad_jobs->id; | 200 | //$params_job['ad_employer_id'] = $ad_jobs->id; |
201 | //Ad_jobs::create($params_job); | 201 | //Ad_jobs::create($params_job); |
202 | $ad_jobs->jobs()->sync($request->get('job_title_id')); | 202 | $ad_jobs->jobs()->sync($request->get('job_title_id')); |
203 | 203 | ||
204 | return redirect()->route('employer.vacancy_list'); | 204 | return redirect()->route('employer.vacancy_list'); |
205 | } | 205 | } |
206 | 206 | ||
207 | // Список вакансий | 207 | // Список вакансий |
208 | public function vacancy_list(Request $request) { | 208 | public function vacancy_list(Request $request) { |
209 | $id = Auth()->user()->id; | 209 | $id = Auth()->user()->id; |
210 | 210 | ||
211 | //dd($request->all()); | 211 | //dd($request->all()); |
212 | $Employer = Employer::query()->where('user_id', $id)->first(); | 212 | $Employer = Employer::query()->where('user_id', $id)->first(); |
213 | $vacancy_list = Ad_employer::query() | 213 | $vacancy_list = Ad_employer::query() |
214 | ->with('jobs') | 214 | ->with('jobs') |
215 | ->with('jobs_code') | 215 | ->with('jobs_code') |
216 | ->where('employer_id', $Employer->id) | 216 | ->where('employer_id', $Employer->id) |
217 | ->where('is_remove', 0) | 217 | ->where('is_remove', 0) |
218 | ->orderbyDesc('updated_at') | 218 | ->orderbyDesc('updated_at') |
219 | ; | 219 | ; |
220 | 220 | ||
221 | if (($request->has('search')) && (!empty($request->get('search')))) { | 221 | if (($request->has('search')) && (!empty($request->get('search')))) { |
222 | $search = $request->get('search'); | 222 | $search = $request->get('search'); |
223 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); | 223 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); |
224 | } | 224 | } |
225 | 225 | ||
226 | if ($request->get('sort')) { | 226 | if ($request->get('sort')) { |
227 | $sort = $request->get('sort'); | 227 | $sort = $request->get('sort'); |
228 | switch ($sort) { | 228 | switch ($sort) { |
229 | case 'nopublic': $vacancy_list->where('active_is', '=', 0);break; | 229 | case 'nopublic': $vacancy_list->where('active_is', '=', 0);break; |
230 | case 'public':$vacancy_list->where('active_is', '=', 1);break; | 230 | case 'public':$vacancy_list->where('active_is', '=', 1);break; |
231 | default: $vacancy_list = $vacancy_list->orderByDesc('id'); break; | 231 | default: $vacancy_list = $vacancy_list->orderByDesc('id'); break; |
232 | } | 232 | } |
233 | } else { | 233 | } else { |
234 | $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); | 234 | $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); |
235 | } | 235 | } |
236 | 236 | ||
237 | $vacancy_list = $vacancy_list->paginate(10); | 237 | $vacancy_list = $vacancy_list->paginate(10); |
238 | 238 | ||
239 | //ajax | 239 | //ajax |
240 | if ($request->ajax()) { | 240 | if ($request->ajax()) { |
241 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); | 241 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); |
242 | } else { | 242 | } else { |
243 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); | 243 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | // Карточка вакансии | 247 | // Карточка вакансии |
248 | public function vacancy_edit(Ad_employer $ad_employer) { | 248 | public function vacancy_edit(Ad_employer $ad_employer) { |
249 | $id = Auth()->user()->id; | 249 | $id = Auth()->user()->id; |
250 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 250 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
251 | 251 | ||
252 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 252 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
253 | where('is_remove', '=', '0')-> | 253 | where('is_remove', '=', '0')-> |
254 | where('is_bd', '=', '0')->get(); | 254 | where('is_bd', '=', '0')->get(); |
255 | 255 | ||
256 | $Employer = Employer::query()->with('users')->with('ads')-> | 256 | $Employer = Employer::query()->with('users')->with('ads')-> |
257 | with('flots')->where('user_id', $id)->first(); | 257 | with('flots')->where('user_id', $id)->first(); |
258 | 258 | ||
259 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 259 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
260 | } | 260 | } |
261 | 261 | ||
262 | // Сохранение-редактирование записи | 262 | // Сохранение-редактирование записи |
263 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { | 263 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { |
264 | $params = $request->all(); | 264 | $params = $request->all(); |
265 | $params_job["job_title_id"] = $params['job_title_id']; | 265 | $params_job["job_title_id"] = $params['job_title_id']; |
266 | 266 | ||
267 | $ad_employer->update($params); | 267 | $ad_employer->update($params); |
268 | $ad_employer->jobs()->sync($request->get('job_title_id')); | 268 | $ad_employer->jobs()->sync($request->get('job_title_id')); |
269 | 269 | ||
270 | $id = Auth()->user()->id; | 270 | $id = Auth()->user()->id; |
271 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 271 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
272 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') | 272 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') |
273 | ->where('is_remove', '=', '0') | 273 | ->where('is_remove', '=', '0') |
274 | ->where('is_bd', '=', '0') | 274 | ->where('is_bd', '=', '0') |
275 | ->get(); | 275 | ->get(); |
276 | 276 | ||
277 | $Employer = Employer::query() | 277 | $Employer = Employer::query() |
278 | ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); | 278 | ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); |
279 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 279 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
280 | } | 280 | } |
281 | 281 | ||
282 | // Сохранение карточки вакансии | 282 | // Сохранение карточки вакансии |
283 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { | 283 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { |
284 | $all = $request->all(); | 284 | $all = $request->all(); |
285 | $ad_employer->update($all); | 285 | $ad_employer->update($all); |
286 | return redirect()->route('employer.cabinet_vacancie'); | 286 | return redirect()->route('employer.cabinet_vacancie'); |
287 | } | 287 | } |
288 | 288 | ||
289 | // Удаление карточки вакансии | 289 | // Удаление карточки вакансии |
290 | public function vacancy_delete(Ad_employer $ad_employer) { | 290 | public function vacancy_delete(Ad_employer $ad_employer) { |
291 | $ad_employer->delete(); | 291 | $ad_employer->delete(); |
292 | 292 | ||
293 | return redirect()->route('employer.vacancy_list') | 293 | return redirect()->route('employer.vacancy_list') |
294 | ->with('success', 'Данные были успешно сохранены'); | 294 | ->with('success', 'Данные были успешно сохранены'); |
295 | } | 295 | } |
296 | 296 | ||
297 | // Обновление даты | 297 | // Обновление даты |
298 | public function vacancy_up(Ad_employer $ad_employer) { | 298 | public function vacancy_up(Ad_employer $ad_employer) { |
299 | $up = date('m/d/Y h:i:s', time());; | 299 | $up = date('m/d/Y h:i:s', time());; |
300 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 300 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
301 | $vac_emp->updated_at = $up; | 301 | $vac_emp->updated_at = $up; |
302 | $vac_emp->save(); | 302 | $vac_emp->save(); |
303 | 303 | ||
304 | return redirect()->back(); //route('employer.vacancy_list'); | 304 | return redirect()->back(); //route('employer.vacancy_list'); |
305 | // начало конца | 305 | // начало конца |
306 | } | 306 | } |
307 | 307 | ||
308 | //Видимость вакансии | 308 | //Видимость вакансии |
309 | public function vacancy_eye(Ad_employer $ad_employer, $status) { | 309 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
310 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 310 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
311 | $vac_emp->active_is = $status; | 311 | $vac_emp->active_is = $status; |
312 | $vac_emp->save(); | 312 | $vac_emp->save(); |
313 | 313 | ||
314 | return redirect()->route('employer.vacancy_list'); | 314 | return redirect()->route('employer.vacancy_list'); |
315 | } | 315 | } |
316 | 316 | ||
317 | //Вакансия редактирования (шаблон) | 317 | //Вакансия редактирования (шаблон) |
318 | public function vacancy_update(Ad_employer $id) { | 318 | public function vacancy_update(Ad_employer $id) { |
319 | 319 | ||
320 | } | 320 | } |
321 | 321 | ||
322 | //Отклики на вакансию - лист | 322 | //Отклики на вакансию - лист |
323 | public function answers(Employer $employer, Request $request) { | 323 | public function answers(Employer $employer, Request $request) { |
324 | $user_id = Auth()->user()->id; | 324 | $user_id = Auth()->user()->id; |
325 | $answer = Ad_employer::query()->where('employer_id', $employer->id); | 325 | $answer = Ad_employer::query()->where('employer_id', $employer->id); |
326 | if ($request->has('search')) { | 326 | if ($request->has('search')) { |
327 | $search = trim($request->get('search')); | 327 | $search = trim($request->get('search')); |
328 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); | 328 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); |
329 | } | 329 | } |
330 | 330 | ||
331 | $answer = $answer->with('response')->OrderByDESC('id')->get(); | 331 | $answer = $answer->with('response')->OrderByDESC('id')->get(); |
332 | 332 | ||
333 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); | 333 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); |
334 | } | 334 | } |
335 | 335 | ||
336 | //Обновление статуса | 336 | //Обновление статуса |
337 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { | 337 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { |
338 | $ad_response->update(Array('flag' => $flag)); | 338 | $ad_response->update(Array('flag' => $flag)); |
339 | return redirect()->route('employer.answers', ['employer' => $employer->id]); | 339 | return redirect()->route('employer.answers', ['employer' => $employer->id]); |
340 | } | 340 | } |
341 | 341 | ||
342 | //Страницы сообщений список | 342 | //Страницы сообщений список |
343 | public function messages($type_message) { | 343 | public function messages($type_message) { |
344 | $user_id = Auth()->user()->id; | 344 | $user_id = Auth()->user()->id; |
345 | 345 | ||
346 | $chats = Chat::get_user_chats($user_id); | 346 | $chats = Chat::get_user_chats($user_id); |
347 | $user_type = 'employer'; | 347 | $user_type = 'employer'; |
348 | $admin_chat = false; | 348 | $admin_chat = false; |
349 | 349 | ||
350 | return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type')); | 350 | return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type')); |
351 | } | 351 | } |
352 | 352 | ||
353 | // Диалог между пользователями | 353 | // Диалог между пользователями |
354 | public function dialog(Chat $chat, Request $request) { | 354 | public function dialog(Chat $chat, Request $request) { |
355 | // Получение параметров. | 355 | // Получение параметров. |
356 | if ($request->has('ad_employer')){ | 356 | if ($request->has('ad_employer')){ |
357 | $ad_employer = $request->get('ad_employer'); | 357 | $ad_employer = $request->get('ad_employer'); |
358 | } else { | 358 | } else { |
359 | $ad_employer = 0; | 359 | $ad_employer = 0; |
360 | } | 360 | } |
361 | 361 | ||
362 | $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); | 362 | $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); |
363 | $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); | 363 | $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); |
364 | 364 | ||
365 | $Messages = Chat::get_chat_messages($chat); | 365 | $Messages = Chat::get_chat_messages($chat); |
366 | 366 | ||
367 | Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]); | 367 | Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]); |
368 | 368 | ||
369 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); | 369 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); |
370 | } | 370 | } |
371 | 371 | ||
372 | public function pin_chat(Request $request){ | 372 | public function pin_chat(Request $request){ |
373 | $chat_id = $request->get('id'); | 373 | $chat_id = $request->get('id'); |
374 | $is_fixed = $request->get('is_fixed'); | 374 | $is_fixed = $request->get('is_fixed'); |
375 | 375 | ||
376 | Chat::pin_chat($chat_id, $is_fixed); | 376 | Chat::pin_chat($chat_id, $is_fixed); |
377 | } | 377 | } |
378 | 378 | ||
379 | public function remove_chat(Request $request){ | 379 | public function remove_chat(Request $request){ |
380 | $chat_id = $request->get('id'); | 380 | $chat_id = $request->get('id'); |
381 | Chat::remove_chat($chat_id); | 381 | Chat::remove_chat($chat_id); |
382 | } | 382 | } |
383 | 383 | ||
384 | // Регистрация работодателя | 384 | // Регистрация работодателя |
385 | public function register_employer(Request $request) { | 385 | public function register_employer(Request $request) { |
386 | $params = $request->all(); | 386 | $params = $request->all(); |
387 | 387 | ||
388 | $rules = [ | 388 | $rules = [ |
389 | //'surname' => ['required', 'string', 'max:255'], | 389 | //'surname' => ['required', 'string', 'max:255'], |
390 | //'name_man' => ['required', 'string', 'max:255'], | 390 | //'name_man' => ['required', 'string', 'max:255'], |
391 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | 391 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
392 | 'name_company' => ['required', 'string', 'max:255'], | 392 | 'name_company' => ['required', 'string', 'max:255'], |
393 | 'password' => ['required', 'string', 'min:6'], | 393 | 'password' => ['required', 'string', 'min:6'], |
394 | ]; | 394 | ]; |
395 | 395 | ||
396 | $messages = [ | 396 | $messages = [ |
397 | 'required' => 'Укажите обязательное поле', | 397 | 'required' => 'Укажите обязательное поле', |
398 | 'min' => [ | 398 | 'min' => [ |
399 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 399 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
400 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 400 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
401 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 401 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
402 | ], | 402 | ], |
403 | 'max' => [ | 403 | 'max' => [ |
404 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 404 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
405 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 405 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
406 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 406 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
407 | ] | 407 | ] |
408 | ]; | 408 | ]; |
409 | 409 | ||
410 | $email = $request->get('email'); | 410 | $email = $request->get('email'); |
411 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 411 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
412 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 412 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
413 | } | 413 | } |
414 | 414 | ||
415 | if ($request->get('password') !== $request->get('confirmed')){ | 415 | if ($request->get('password') !== $request->get('confirmed')){ |
416 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 416 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
417 | } | 417 | } |
418 | 418 | ||
419 | if (strlen($request->get('password')) < 6) { | 419 | if (strlen($request->get('password')) < 6) { |
420 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 420 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
421 | } | 421 | } |
422 | 422 | ||
423 | if (empty($request->get('surname'))) { | 423 | if (empty($request->get('surname'))) { |
424 | $params['surname'] = 'Неизвестно'; | 424 | $params['surname'] = 'Неизвестно'; |
425 | } | 425 | } |
426 | if (empty($request->get('name_man'))) { | 426 | if (empty($request->get('name_man'))) { |
427 | $params['name_man'] = 'Неизвестно'; | 427 | $params['name_man'] = 'Неизвестно'; |
428 | } | 428 | } |
429 | $validator = Validator::make($params, $rules, $messages); | 429 | $validator = Validator::make($params, $rules, $messages); |
430 | 430 | ||
431 | if ($validator->fails()) { | 431 | if ($validator->fails()) { |
432 | return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 432 | return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
433 | } else { | 433 | } else { |
434 | $user = $this->create($params); | 434 | $user = $this->create($params); |
435 | event(new Registered($user)); | 435 | event(new Registered($user)); |
436 | 436 | ||
437 | try { | 437 | try { |
438 | Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); | 438 | Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); |
439 | } catch (Throwable $e) { | 439 | } catch (Throwable $e) { |
440 | Log::error($e); | 440 | Log::error($e); |
441 | } | 441 | } |
442 | 442 | ||
443 | Auth::guard()->login($user); | 443 | Auth::guard()->login($user); |
444 | } | 444 | } |
445 | 445 | ||
446 | if ($user) { | 446 | if ($user) { |
447 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | 447 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; |
448 | } else { | 448 | } else { |
449 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 449 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
450 | } | 450 | } |
451 | } | 451 | } |
452 | 452 | ||
453 | // Создание пользователя | 453 | // Создание пользователя |
454 | protected function create(array $data) | 454 | protected function create(array $data) |
455 | { | 455 | { |
456 | $Use = new User_Model(); | 456 | $Use = new User_Model(); |
457 | $Code_user = $Use->create([ | 457 | $Code_user = $Use->create([ |
458 | 'name' => $data['surname']." ".$data['name_man'], | 458 | 'name' => $data['surname']." ".$data['name_man'], |
459 | 'name_man' => $data['name_man'], | 459 | 'name_man' => $data['name_man'], |
460 | 'surname' => $data['surname'], | 460 | 'surname' => $data['surname'], |
461 | 'surname2' => $data['surname2'], | 461 | 'surname2' => $data['surname2'], |
462 | 'subscribe_email' => $data['email'], | 462 | 'subscribe_email' => $data['email'], |
463 | 'email' => $data['email'], | 463 | 'email' => $data['email'], |
464 | 'telephone' => $data['telephone'], | 464 | 'telephone' => $data['telephone'], |
465 | 'is_worker' => 0, | 465 | 'is_worker' => 0, |
466 | 'password' => Hash::make($data['password']), | 466 | 'password' => Hash::make($data['password']), |
467 | 'pubpassword' => base64_encode($data['password']), | 467 | 'pubpassword' => base64_encode($data['password']), |
468 | 'email_verified_at' => Carbon::now() | 468 | 'email_verified_at' => Carbon::now() |
469 | ]); | 469 | ]); |
470 | 470 | ||
471 | if ($Code_user->id > 0) { | 471 | if ($Code_user->id > 0) { |
472 | $Employer = new Employer(); | 472 | $Employer = new Employer(); |
473 | $Employer->user_id = $Code_user->id; | 473 | $Employer->user_id = $Code_user->id; |
474 | $Employer->name_company = $data['name_company']; | 474 | $Employer->name_company = $data['name_company']; |
475 | $Employer->email = $data['email']; | 475 | $Employer->email = $data['email']; |
476 | $Employer->telephone = $data['telephone']; | 476 | $Employer->telephone = $data['telephone']; |
477 | $Employer->code = Tools::generator_id(10); | 477 | $Employer->code = Tools::generator_id(10); |
478 | $Employer->save(); | 478 | $Employer->save(); |
479 | 479 | ||
480 | return $Code_user; | 480 | return $Code_user; |
481 | } | 481 | } |
482 | } | 482 | } |
483 | 483 | ||
484 | // Отправка сообщения от работодателя | 484 | // Отправка сообщения от работодателя |
485 | public function send_message(MessagesRequiest $request) { | 485 | public function send_message(MessagesRequiest $request) { |
486 | $params = $request->all(); | 486 | $params = $request->all(); |
487 | dd($params); | 487 | dd($params); |
488 | $user1 = $params['user_id']; | 488 | $user1 = $params['user_id']; |
489 | $user2 = $params['to_user_id']; | 489 | $user2 = $params['to_user_id']; |
490 | 490 | ||
491 | if ($request->has('file')) { | 491 | if ($request->has('file')) { |
492 | $params['file'] = $request->file('file')->store("messages", 'public'); | 492 | $params['file'] = $request->file('file')->store("messages", 'public'); |
493 | } | 493 | } |
494 | Message::create($params); | 494 | Message::create($params); |
495 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 495 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
496 | } | 496 | } |
497 | 497 | ||
498 | public function test123(Request $request) { | 498 | public function test123(Request $request) { |
499 | $params = $request->all(); | 499 | $params = $request->all(); |
500 | $user1 = $params['user_id']; | 500 | $user1 = $params['user_id']; |
501 | $user2 = $params['to_user_id']; | 501 | $user2 = $params['to_user_id']; |
502 | 502 | ||
503 | $rules = [ | 503 | $rules = [ |
504 | 'text' => 'nullable|required_without:file|min:1|max:150000', | 504 | 'text' => 'nullable|required_without:file|min:1|max:150000', |
505 | 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 505 | 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
506 | ]; | 506 | ]; |
507 | $messages = [ | 507 | $messages = [ |
508 | 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', | 508 | 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', |
509 | 'min' => [ | 509 | 'min' => [ |
510 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 510 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
511 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 511 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
512 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 512 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
513 | ], | 513 | ], |
514 | 'max' => [ | 514 | 'max' => [ |
515 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 515 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
516 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 516 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
517 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 517 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
518 | ] | 518 | ] |
519 | ]; | 519 | ]; |
520 | 520 | ||
521 | $validator = Validator::make($request->all(), $rules, $messages); | 521 | $validator = Validator::make($request->all(), $rules, $messages); |
522 | 522 | ||
523 | if ($validator->fails()) { | 523 | if ($validator->fails()) { |
524 | $chat = Chat::where('user_id', $user1) | 524 | return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); |
525 | ->where('to_user_id', $user2) | 525 | } |
526 | ->where('is_removed', 0) | ||
527 | ->first() | ||
528 | ; | ||
529 | if ($chat->id){ | ||
530 | return redirect()->route('employer.dialog', ['chat' => $chat->id])->withErrors($validator); | ||
531 | } else { | ||
532 | return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); | ||
533 | } | ||
534 | |||
535 | } else { | ||
536 | $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); | ||
537 | 526 | ||
538 | return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]); | 527 | $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); |
528 | return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]); | ||
539 | 529 | ||
540 | } | ||
541 | } | 530 | } |
542 | 531 | ||
543 | //Избранные люди | 532 | //Избранные люди |
544 | public function favorites(Request $request) | 533 | public function favorites(Request $request) |
545 | { | 534 | { |
546 | $likedWorkersIds = Like_worker::query() | 535 | $likedWorkersIds = Like_worker::query() |
547 | ->where('user_id', Auth::user()->id) | 536 | ->where('user_id', Auth::user()->id) |
548 | ->get() | 537 | ->get() |
549 | ->pluck('code_record') | 538 | ->pluck('code_record') |
550 | ->toArray(); | 539 | ->toArray(); |
551 | 540 | ||
552 | $workerBuilder = Worker::query() | 541 | $workerBuilder = Worker::query() |
553 | ->whereIn('id', $likedWorkersIds); | 542 | ->whereIn('id', $likedWorkersIds); |
554 | 543 | ||
555 | if (($request->has('search')) && (!empty($request->get('search')))) { | 544 | if (($request->has('search')) && (!empty($request->get('search')))) { |
556 | $search = $request->get('search'); | 545 | $search = $request->get('search'); |
557 | 546 | ||
558 | $workerBuilder->whereHas('users', function (Builder $query) use ($search) { | 547 | $workerBuilder->whereHas('users', function (Builder $query) use ($search) { |
559 | $query->where('surname', 'LIKE', "%$search%") | 548 | $query->where('surname', 'LIKE', "%$search%") |
560 | ->oWhere('name_man', 'LIKE', "%$search%") | 549 | ->oWhere('name_man', 'LIKE', "%$search%") |
561 | ->orWhere('surname2', 'LIKE', "%$search%"); | 550 | ->orWhere('surname2', 'LIKE', "%$search%"); |
562 | }); | 551 | }); |
563 | } | 552 | } |
564 | 553 | ||
565 | $Workers = $workerBuilder->get(); | 554 | $Workers = $workerBuilder->get(); |
566 | 555 | ||
567 | return view('employers.favorite', compact('Workers')); | 556 | return view('employers.favorite', compact('Workers')); |
568 | } | 557 | } |
569 | 558 | ||
570 | // База данных | 559 | // База данных |
571 | public function bd(Request $request) { | 560 | public function bd(Request $request) { |
572 | $users = User_Model::query()->with('workers')->with('jobtitles'); | 561 | $users = User_Model::query()->with('workers')->with('jobtitles'); |
573 | 562 | ||
574 | if ($request->has('search')) { | 563 | if ($request->has('search')) { |
575 | $find_key = $request->get('search'); | 564 | $find_key = $request->get('search'); |
576 | $users = $users->where('name', 'LIKE', "%$find_key%") | 565 | $users = $users->where('name', 'LIKE', "%$find_key%") |
577 | ->orWhere('surname', 'LIKE', "%$find_key%") | 566 | ->orWhere('surname', 'LIKE', "%$find_key%") |
578 | ->orWhere('name_man', 'LIKE', "%$find_key%") | 567 | ->orWhere('name_man', 'LIKE', "%$find_key%") |
579 | ->orWhere('email', 'LIKE', "%$find_key%") | 568 | ->orWhere('email', 'LIKE', "%$find_key%") |
580 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 569 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
581 | } | 570 | } |
582 | 571 | ||
583 | // Данные | 572 | // Данные |
584 | $users = $users->Baseuser()-> | 573 | $users = $users->Baseuser()-> |
585 | orderByDesc(Worker::select('created_at')->whereColumn('workers.user_id', 'users.id')); | 574 | orderByDesc(Worker::select('created_at')->whereColumn('workers.user_id', 'users.id')); |
586 | $count_users = $users; | 575 | $count_users = $users; |
587 | $users = $users->paginate(5); | 576 | $users = $users->paginate(5); |
588 | 577 | ||
589 | $export_options = DbExportColumns::toArray(); | 578 | $export_options = DbExportColumns::toArray(); |
590 | 579 | ||
591 | $jobs_titles = Job_title::select('id', 'name') | 580 | $jobs_titles = Job_title::select('id', 'name') |
592 | ->where('is_remove', '=', 0) | 581 | ->where('is_remove', '=', 0) |
593 | ->where('is_bd', '=', 2) | 582 | ->where('is_bd', '=', 2) |
594 | ->orderByDesc('sort') | 583 | ->orderByDesc('sort') |
595 | ->orderBy('name', 'asc') | 584 | ->orderBy('name', 'asc') |
596 | ->get() | 585 | ->get() |
597 | ->toArray() | 586 | ->toArray() |
598 | ; | 587 | ; |
599 | 588 | ||
600 | return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); | 589 | return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); |
601 | } | 590 | } |
602 | 591 | ||
603 | //Настройка уведомлений | 592 | //Настройка уведомлений |
604 | public function subscribe() { | 593 | public function subscribe() { |
605 | return view('employers.subcribe'); | 594 | return view('employers.subcribe'); |
606 | } | 595 | } |
607 | 596 | ||
608 | //Установка уведомлений сохранение | 597 | //Установка уведомлений сохранение |
609 | public function save_subscribe(Request $request) { | 598 | public function save_subscribe(Request $request) { |
610 | dd($request->all()); | 599 | dd($request->all()); |
611 | $msg = $request->validate([ | 600 | $msg = $request->validate([ |
612 | 'subscribe_email' => 'required|email|min:5|max:255', | 601 | 'subscribe_email' => 'required|email|min:5|max:255', |
613 | ]); | 602 | ]); |
614 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); | 603 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); |
615 | } | 604 | } |
616 | 605 | ||
617 | //Сбросить форму с паролем | 606 | //Сбросить форму с паролем |
618 | public function password_reset() { | 607 | public function password_reset() { |
619 | $email = Auth()->user()->email; | 608 | $email = Auth()->user()->email; |
620 | return view('employers.password-reset', compact('email')); | 609 | return view('employers.password-reset', compact('email')); |
621 | } | 610 | } |
622 | 611 | ||
623 | //Обновление пароля | 612 | //Обновление пароля |
624 | public function new_password(Request $request) { | 613 | public function new_password(Request $request) { |
625 | $use = Auth()->user(); | 614 | $use = Auth()->user(); |
626 | $request->validate([ | 615 | $request->validate([ |
627 | 'password' => 'required|string', | 616 | 'password' => 'required|string', |
628 | 'new_password' => 'required|string', | 617 | 'new_password' => 'required|string', |
629 | 'new_password2' => 'required|string' | 618 | 'new_password2' => 'required|string' |
630 | ]); | 619 | ]); |
631 | 620 | ||
632 | if ($request->get('new_password') == $request->get('new_password2')) | 621 | if ($request->get('new_password') == $request->get('new_password2')) |
633 | if ($request->get('password') !== $request->get('new_password')) { | 622 | if ($request->get('password') !== $request->get('new_password')) { |
634 | $credentials = $request->only('email', 'password'); | 623 | $credentials = $request->only('email', 'password'); |
635 | if (Auth::attempt($credentials)) { | 624 | if (Auth::attempt($credentials)) { |
636 | 625 | ||
637 | if (!is_null($use->email_verified_at)){ | 626 | if (!is_null($use->email_verified_at)){ |
638 | 627 | ||
639 | $user_data = User_Model::find($use->id); | 628 | $user_data = User_Model::find($use->id); |
640 | $user_data->update([ | 629 | $user_data->update([ |
641 | 'password' => Hash::make($request->get('new_password')), | 630 | 'password' => Hash::make($request->get('new_password')), |
642 | 'pubpassword' => base64_encode($request->get('new_password')), | 631 | 'pubpassword' => base64_encode($request->get('new_password')), |
643 | ]); | 632 | ]); |
644 | return redirect() | 633 | return redirect() |
645 | ->route('employer.password_reset') | 634 | ->route('employer.password_reset') |
646 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 635 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
647 | } | 636 | } |
648 | 637 | ||
649 | return redirect() | 638 | return redirect() |
650 | ->route('employer.password_reset') | 639 | ->route('employer.password_reset') |
651 | ->withError('Данная учетная запись не было верифицированна!'); | 640 | ->withError('Данная учетная запись не было верифицированна!'); |
652 | } | 641 | } |
653 | } | 642 | } |
654 | 643 | ||
655 | return redirect() | 644 | return redirect() |
656 | ->route('employer.password_reset') | 645 | ->route('employer.password_reset') |
657 | ->withErrors('Не совпадение данных, обновите пароли!'); | 646 | ->withErrors('Не совпадение данных, обновите пароли!'); |
658 | } | 647 | } |
659 | 648 | ||
660 | 649 | ||
661 | 650 | ||
662 | // Форма Удаление пипла | 651 | // Форма Удаление пипла |
663 | public function delete_people() { | 652 | public function delete_people() { |
664 | $login = Auth()->user()->email; | 653 | $login = Auth()->user()->email; |
665 | return view('employers.delete_people', compact('login')); | 654 | return view('employers.delete_people', compact('login')); |
666 | } | 655 | } |
667 | 656 | ||
668 | // Удаление аккаунта | 657 | // Удаление аккаунта |
669 | public function action_delete_user(Request $request) { | 658 | public function action_delete_user(Request $request) { |
670 | $Answer = $request->all(); | 659 | $Answer = $request->all(); |
671 | $user_id = Auth()->user()->id; | 660 | $user_id = Auth()->user()->id; |
672 | $request->validate([ | 661 | $request->validate([ |
673 | 'password' => 'required|string', | 662 | 'password' => 'required|string', |
674 | ]); | 663 | ]); |
675 | 664 | ||
676 | $credentials = $request->only('email', 'password'); | 665 | $credentials = $request->only('email', 'password'); |
677 | if (Auth::attempt($credentials)) { | 666 | if (Auth::attempt($credentials)) { |
678 | Auth::logout(); | 667 | Auth::logout(); |
679 | $it = User_Model::find($user_id); | 668 | $it = User_Model::find($user_id); |
680 | $it->delete(); | 669 | $it->delete(); |
681 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 670 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
682 | } else { | 671 | } else { |
683 | return redirect()->route('employer.delete_people') | 672 | return redirect()->route('employer.delete_people') |
684 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 673 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
685 | } | 674 | } |
686 | } | 675 | } |
687 | 676 | ||
688 | public function ajax_delete_user(Request $request) { | 677 | public function ajax_delete_user(Request $request) { |
689 | $Answer = $request->all(); | 678 | $Answer = $request->all(); |
690 | $user_id = Auth()->user()->id; | 679 | $user_id = Auth()->user()->id; |
691 | $request->validate([ | 680 | $request->validate([ |
692 | 'password' => 'required|string', | 681 | 'password' => 'required|string', |
693 | ]); | 682 | ]); |
694 | $credentials = $request->only('email', 'password'); | 683 | $credentials = $request->only('email', 'password'); |
695 | if (Auth::attempt($credentials)) { | 684 | if (Auth::attempt($credentials)) { |
696 | 685 | ||
697 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', | 686 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', |
698 | 'email' => $request->get('email'), | 687 | 'email' => $request->get('email'), |
699 | 'password' => $request->get('password'))); | 688 | 'password' => $request->get('password'))); |
700 | } else { | 689 | } else { |
701 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); | 690 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); |
702 | } | 691 | } |
703 | } | 692 | } |
704 | 693 | ||
705 | // Рассылка сообщений | 694 | // Рассылка сообщений |
706 | public function send_all_messages() { | 695 | public function send_all_messages() { |
707 | $id = Auth()->user()->id; | 696 | $id = Auth()->user()->id; |
708 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); | 697 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); |
709 | 698 | ||
710 | $job_titles = Job_title::query() | 699 | $job_titles = Job_title::query() |
711 | ->where('is_remove', '=', 0) | 700 | ->where('is_remove', '=', 0) |
712 | ->where('is_bd', '=', 1) | 701 | ->where('is_bd', '=', 1) |
713 | ->orderByDesc('sort') | 702 | ->orderByDesc('sort') |
714 | ->get(); | 703 | ->get(); |
715 | 704 | ||
716 | if ($sending->sending_is) | 705 | if ($sending->sending_is) |
717 | return view('employers.send_all', compact('job_titles')); | 706 | return view('employers.send_all', compact('job_titles')); |
718 | else | 707 | else |
719 | return view('employers.send_all_danger'); | 708 | return view('employers.send_all_danger'); |
720 | } | 709 | } |
721 | 710 | ||
722 | // Отправка сообщений для информации | 711 | // Отправка сообщений для информации |
723 | public function send_all_post(Request $request) { | 712 | public function send_all_post(Request $request) { |
724 | $data = $request->all(); | 713 | $data = $request->all(); |
725 | $data['user'] = Auth()->user(); | 714 | $data['user'] = Auth()->user(); |
726 | 715 | ||
727 | $id = MessagesRequests::create([ | 716 | $id = MessagesRequests::create([ |
728 | 'user_id' => $data['user']->id, | 717 | 'user_id' => $data['user']->id, |
729 | 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null, | 718 | 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null, |
730 | 'text' => $data['message_text'], | 719 | 'text' => $data['message_text'], |
731 | ]); | 720 | ]); |
732 | 721 | ||
733 | try { | 722 | try { |
734 | if (!empty($id)) { | 723 | if (!empty($id)) { |
735 | Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data)); | 724 | Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data)); |
736 | } | 725 | } |
737 | } catch (Throwable $e) { | 726 | } catch (Throwable $e) { |
738 | Log::error($e); | 727 | Log::error($e); |
739 | return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее'); | 728 | return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее'); |
740 | } | 729 | } |
741 | 730 | ||
742 | return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.'); | 731 | return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.'); |
743 | } | 732 | } |
744 | 733 | ||
745 | // База резюме | 734 | // База резюме |
746 | public function bd_tupe(Request $request) { | 735 | public function bd_tupe(Request $request) { |
747 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); | 736 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); |
748 | 737 | ||
749 | return view('employers.bd_tupe', compact('Resume')); | 738 | return view('employers.bd_tupe', compact('Resume')); |
750 | } | 739 | } |
751 | 740 | ||
752 | ////////////////////////////////////////////////////////////////// | 741 | ////////////////////////////////////////////////////////////////// |
753 | // Отправил сообщение | 742 | // Отправил сообщение |
754 | ////////////////////////////////////////////////////////////////// | 743 | ////////////////////////////////////////////////////////////////// |
755 | public function new_message(Request $request) | 744 | public function new_message(Request $request) |
756 | { | 745 | { |
757 | $params = $request->all(); | 746 | $params = $request->all(); |
758 | 747 | ||
759 | $id = $params['_user_id']; | 748 | $id = $params['send_user_id']; |
760 | $message_params = [ | 749 | $message_params = [ |
761 | 'title' => $params['title'], | 750 | 'title' => $params['send_title'], |
762 | 'text' => $params['text'], | 751 | 'text' => $params['send_text'], |
763 | 'ad_employer_id' => $params['_vacancy'], | 752 | 'ad_employer_id' => $params['send_vacancy'], |
764 | 'flag_new' => 1 | 753 | 'flag_new' => 1 |
765 | ]; | 754 | ]; |
766 | 755 | ||
767 | dd($params); | 756 | $message = Message::add_message( |
768 | |||
769 | Message::add_message( | ||
770 | $request, | 757 | $request, |
771 | $params['_user_id'], | 758 | $params['send_user_id'], |
772 | $params['_to_user_id'], | 759 | $params['send_to_user_id'], |
773 | $message_params, | 760 | $message_params, |
774 | file_store_path: "worker/$id" | 761 | file_store_path: "worker/$id" |
775 | ); | 762 | ); |
776 | 763 | ||
777 | return redirect()->route('employer.messages', ['type_message' => 'output']); | 764 | return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]); |
778 | } | 765 | } |
779 | 766 | ||
780 | // Восстановление пароля | 767 | // Восстановление пароля |
781 | public function repair_password(Request $request) { | 768 | public function repair_password(Request $request) { |
782 | $params = $request->get('email'); | 769 | $params = $request->get('email'); |
783 | } | 770 | } |
784 | 771 | ||
785 | // Избранные люди на корабль | 772 | // Избранные люди на корабль |
786 | public function selected_people(Request $request) { | 773 | public function selected_people(Request $request) { |
787 | $id = $request->get('id'); | 774 | $id = $request->get('id'); |
788 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 775 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
789 | where('is_remove', '=', '0')-> | 776 | where('is_remove', '=', '0')-> |
790 | where('is_bd', '=', '0')-> | 777 | where('is_bd', '=', '0')-> |
791 | where('position_id', $id)-> | 778 | where('position_id', $id)-> |
792 | get(); | 779 | get(); |
793 | return view('favorite_people', compact('favorite_people')); | 780 | return view('favorite_people', compact('favorite_people')); |
794 | } | 781 | } |
795 | } | 782 | } |
app/Http/Controllers/WorkerController.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\DocumentsRequest; | 7 | use App\Http\Requests\DocumentsRequest; |
8 | use App\Http\Requests\PrevCompanyRequest; | 8 | use App\Http\Requests\PrevCompanyRequest; |
9 | use App\Http\Requests\SertificationRequest; | 9 | use App\Http\Requests\SertificationRequest; |
10 | use App\Models\Ad_employer; | 10 | use App\Models\Ad_employer; |
11 | use App\Models\ad_response; | 11 | use App\Models\ad_response; |
12 | use App\Models\Chat; | 12 | use App\Models\Chat; |
13 | use App\Models\Dop_info; | 13 | use App\Models\Dop_info; |
14 | use App\Models\infobloks; | 14 | use App\Models\infobloks; |
15 | use App\Models\Job_title; | 15 | use App\Models\Job_title; |
16 | use App\Models\Like_vacancy; | 16 | use App\Models\Like_vacancy; |
17 | use App\Models\Message; | 17 | use App\Models\Message; |
18 | use App\Models\place_works; | 18 | use App\Models\place_works; |
19 | use App\Models\PrevCompany; | 19 | use App\Models\PrevCompany; |
20 | use App\Models\ResponseWork; | 20 | use App\Models\ResponseWork; |
21 | use App\Models\sertification; | 21 | use App\Models\sertification; |
22 | use App\Models\Static_worker; | 22 | use App\Models\Static_worker; |
23 | use App\Models\Title_worker; | 23 | use App\Models\Title_worker; |
24 | use App\Models\User; | 24 | use App\Models\User; |
25 | use App\Models\User as User_Model; | 25 | use App\Models\User as User_Model; |
26 | use App\Models\Worker; | 26 | use App\Models\Worker; |
27 | use Barryvdh\DomPDF\Facade\Pdf; | 27 | use Barryvdh\DomPDF\Facade\Pdf; |
28 | use Carbon\Carbon; | 28 | use Carbon\Carbon; |
29 | use Illuminate\Auth\Events\Registered; | 29 | use Illuminate\Auth\Events\Registered; |
30 | use Illuminate\Database\Eloquent\Builder; | 30 | use Illuminate\Database\Eloquent\Builder; |
31 | use Illuminate\Http\Request; | 31 | use Illuminate\Http\Request; |
32 | use Illuminate\Support\Facades\Auth; | 32 | use Illuminate\Support\Facades\Auth; |
33 | use Illuminate\Support\Facades\Hash; | 33 | use Illuminate\Support\Facades\Hash; |
34 | use Illuminate\Support\Facades\Storage; | 34 | use Illuminate\Support\Facades\Storage; |
35 | use Illuminate\Support\Facades\Validator; | 35 | use Illuminate\Support\Facades\Validator; |
36 | use PhpOffice\PhpSpreadsheet\Spreadsheet; | 36 | use PhpOffice\PhpSpreadsheet\Spreadsheet; |
37 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; | 37 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; |
38 | use Symfony\Component\HttpFoundation\StreamedResponse; | 38 | use Symfony\Component\HttpFoundation\StreamedResponse; |
39 | use App\Enums\DbExportColumns; | 39 | use App\Enums\DbExportColumns; |
40 | use App\Enums\WorkerStatuses; | 40 | use App\Enums\WorkerStatuses; |
41 | use DateTime; | 41 | use DateTime; |
42 | 42 | ||
43 | class WorkerController extends Controller | 43 | class WorkerController extends Controller |
44 | { | 44 | { |
45 | //профиль | 45 | //профиль |
46 | public function profile(Worker $worker) | 46 | public function profile(Worker $worker) |
47 | { | 47 | { |
48 | $get_date = date('Y.m'); | 48 | $get_date = date('Y.m'); |
49 | 49 | ||
50 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 50 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
51 | ->where('user_id', '=', $worker->users->id) | 51 | ->where('user_id', '=', $worker->users->id) |
52 | ->get(); | 52 | ->get(); |
53 | 53 | ||
54 | if ($c->count() > 0) { | 54 | if ($c->count() > 0) { |
55 | $upd = Static_worker::find($c[0]->id); | 55 | $upd = Static_worker::find($c[0]->id); |
56 | $upd->lookin = $upd->lookin + 1; | 56 | $upd->lookin = $upd->lookin + 1; |
57 | $upd->save(); | 57 | $upd->save(); |
58 | } else { | 58 | } else { |
59 | $crt = new Static_worker(); | 59 | $crt = new Static_worker(); |
60 | $crt->lookin = 1; | 60 | $crt->lookin = 1; |
61 | $crt->year_month = $get_date; | 61 | $crt->year_month = $get_date; |
62 | $crt->user_id = $worker->user_id; | 62 | $crt->user_id = $worker->user_id; |
63 | $crt->save(); | 63 | $crt->save(); |
64 | } | 64 | } |
65 | 65 | ||
66 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 66 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
67 | ->where('user_id', '=', $worker->users->id) | 67 | ->where('user_id', '=', $worker->users->id) |
68 | ->get(); | 68 | ->get(); |
69 | 69 | ||
70 | return view('public.workers.profile', compact('worker', 'stat')); | 70 | return view('public.workers.profile', compact('worker', 'stat')); |
71 | } | 71 | } |
72 | 72 | ||
73 | // лист база резюме | 73 | // лист база резюме |
74 | public function bd_resume(Request $request) | 74 | public function bd_resume(Request $request) |
75 | { | 75 | { |
76 | if (isset(Auth()->user()->id)) { | 76 | if (isset(Auth()->user()->id)) { |
77 | if ((Auth()->user()->is_worker) || (!Auth()->user()->is_lookin)) | 77 | if ((Auth()->user()->is_worker) || (!Auth()->user()->is_lookin)) |
78 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); | 78 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); |
79 | } | 79 | } |
80 | 80 | ||
81 | $status_work = WorkerStatuses::getWorkerStatuses(); | 81 | $status_work = WorkerStatuses::getWorkerStatuses(); |
82 | 82 | ||
83 | $resumes = Worker::query()->with('users')->with('job_titles')->orderByDesc('updated_at'); | 83 | $resumes = Worker::query()->with('users')->with('job_titles')->orderByDesc('updated_at'); |
84 | $resumes = $resumes->whereHas('users', function (Builder $query) { | 84 | $resumes = $resumes->whereHas('users', function (Builder $query) { |
85 | $query->Where('is_worker', '=', '1') | 85 | $query->Where('is_worker', '=', '1') |
86 | ->Where('is_bd', '=', '0'); | 86 | ->Where('is_bd', '=', '0'); |
87 | }); | 87 | }); |
88 | 88 | ||
89 | if (($request->has('job')) && ($request->get('job') > 0)) { | 89 | if (($request->has('job')) && ($request->get('job') > 0)) { |
90 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { | 90 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { |
91 | $query->Where('job_titles.id', $request->get('job')); | 91 | $query->Where('job_titles.id', $request->get('job')); |
92 | }); | 92 | }); |
93 | } | 93 | } |
94 | 94 | ||
95 | $Job_title = Job_title::query() | 95 | $Job_title = Job_title::query() |
96 | ->where('is_remove', '=', '0') | 96 | ->where('is_remove', '=', '0') |
97 | ->where('is_bd', '=' , '1') | 97 | ->where('is_bd', '=' , '1') |
98 | ->orderByDesc('sort') | 98 | ->orderByDesc('sort') |
99 | ->get(); | 99 | ->get(); |
100 | 100 | ||
101 | if ($request->get('sort')) { | 101 | if ($request->get('sort')) { |
102 | $sort = $request->get('sort'); | 102 | $sort = $request->get('sort'); |
103 | switch ($sort) { | 103 | switch ($sort) { |
104 | case 'looking_for_work': | 104 | case 'looking_for_work': |
105 | $resumes->where('status_work', '=', WorkerStatuses::LookingForWork->value); | 105 | $resumes->where('status_work', '=', WorkerStatuses::LookingForWork->value); |
106 | break; | 106 | break; |
107 | case 'considering_offers': | 107 | case 'considering_offers': |
108 | $resumes->where('status_work', '=', WorkerStatuses::ConsideringOffers->value); | 108 | $resumes->where('status_work', '=', WorkerStatuses::ConsideringOffers->value); |
109 | break; | 109 | break; |
110 | case 'not_looking_for_work': | 110 | case 'not_looking_for_work': |
111 | $resumes->where('status_work', '=', WorkerStatuses::NotLookingForWork->value); | 111 | $resumes->where('status_work', '=', WorkerStatuses::NotLookingForWork->value); |
112 | break; | 112 | break; |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | $resumes->where(function (Builder $query) { | 116 | $resumes->where(function (Builder $query) { |
117 | $query->whereNotNull('telephone') | 117 | $query->whereNotNull('telephone') |
118 | ->whereNotNull('email') | 118 | ->whereNotNull('email') |
119 | ->whereNotNull('city') | 119 | ->whereNotNull('city') |
120 | ->whereNotNull('experience') | 120 | ->whereNotNull('experience') |
121 | ->whereNotNull('old_year'); | 121 | ->whereNotNull('old_year'); |
122 | //fixme костыль, переделать | 122 | //fixme костыль, переделать |
123 | }); | 123 | }); |
124 | 124 | ||
125 | $res_count = $resumes->count(); | 125 | $res_count = $resumes->count(); |
126 | $resumes = $resumes->paginate(4); | 126 | $resumes = $resumes->paginate(4); |
127 | if ($request->ajax()) { | 127 | if ($request->ajax()) { |
128 | // Условия обставлены | 128 | // Условия обставлены |
129 | if ($request->has('block') && ($request->get('block') == 1)) { | 129 | if ($request->has('block') && ($request->get('block') == 1)) { |
130 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count')); | 130 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count')); |
131 | } | 131 | } |
132 | } else { | 132 | } else { |
133 | return view('resume', compact('resumes', 'status_work', 'res_count', 'Job_title')); | 133 | return view('resume', compact('resumes', 'status_work', 'res_count', 'Job_title')); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | public function basic_information(){ | 137 | public function basic_information(){ |
138 | if (!isset(Auth()->user()->id)) { | 138 | if (!isset(Auth()->user()->id)) { |
139 | abort(404); | 139 | abort(404); |
140 | } | 140 | } |
141 | 141 | ||
142 | $user_id = Auth()->user()->id; | 142 | $user_id = Auth()->user()->id; |
143 | 143 | ||
144 | $user = User::query() | 144 | $user = User::query() |
145 | ->with('workers') | 145 | ->with('workers') |
146 | ->with(['jobtitles' => function ($query) { | 146 | ->with(['jobtitles' => function ($query) { |
147 | $query->select('job_titles.id'); | 147 | $query->select('job_titles.id'); |
148 | }]) | 148 | }]) |
149 | ->where('id', '=', $user_id) | 149 | ->where('id', '=', $user_id) |
150 | ->first(); | 150 | ->first(); |
151 | $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray(); | 151 | $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray(); |
152 | 152 | ||
153 | $job_titles = Job_title::query() | 153 | $job_titles = Job_title::query() |
154 | ->where('is_remove', '=', 0) | 154 | ->where('is_remove', '=', 0) |
155 | ->where('is_bd', '=', 1) | 155 | ->where('is_bd', '=', 1) |
156 | ->orderByDesc('sort') | 156 | ->orderByDesc('sort') |
157 | ->get() | 157 | ->get() |
158 | ; | 158 | ; |
159 | 159 | ||
160 | return view('workers.form_basic_information', compact('user', 'job_titles')); | 160 | return view('workers.form_basic_information', compact('user', 'job_titles')); |
161 | } | 161 | } |
162 | 162 | ||
163 | public function additional_documents(){ | 163 | public function additional_documents(){ |
164 | if (!isset(Auth()->user()->id)) { | 164 | if (!isset(Auth()->user()->id)) { |
165 | abort(404); | 165 | abort(404); |
166 | } | 166 | } |
167 | 167 | ||
168 | $user_id = Auth()->user()->id; | 168 | $user_id = Auth()->user()->id; |
169 | 169 | ||
170 | $info_blocks = infobloks::query()->OrderBy('name')->get(); | 170 | $info_blocks = infobloks::query()->OrderBy('name')->get(); |
171 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; | 171 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; |
172 | 172 | ||
173 | $worker = Worker::query() | 173 | $worker = Worker::query() |
174 | ->with('users') | 174 | ->with('users') |
175 | ->with('infobloks') | 175 | ->with('infobloks') |
176 | ->WhereHas('users', function (Builder $query) use ($user_id) { | 176 | ->WhereHas('users', function (Builder $query) use ($user_id) { |
177 | $query->Where('id', $user_id); | 177 | $query->Where('id', $user_id); |
178 | }) | 178 | }) |
179 | ->first(); | 179 | ->first(); |
180 | if ($worker->dop_info->count()){ | 180 | if ($worker->dop_info->count()){ |
181 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); | 181 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); |
182 | } | 182 | } |
183 | 183 | ||
184 | return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses')); | 184 | return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses')); |
185 | } | 185 | } |
186 | 186 | ||
187 | //Лайк резюме | 187 | //Лайк резюме |
188 | public function like_controller() { | 188 | public function like_controller() { |
189 | 189 | ||
190 | } | 190 | } |
191 | 191 | ||
192 | // анкета соискателя | 192 | // анкета соискателя |
193 | public function resume_profile(Worker $worker) | 193 | public function resume_profile(Worker $worker) |
194 | { | 194 | { |
195 | if (isset(Auth()->user()->id)) { | 195 | if (isset(Auth()->user()->id)) { |
196 | $idiot = Auth()->user()->id; | 196 | $idiot = Auth()->user()->id; |
197 | } else { | 197 | } else { |
198 | $idiot = 0; | 198 | $idiot = 0; |
199 | } | 199 | } |
200 | 200 | ||
201 | $status_work = WorkerStatuses::getWorkerStatuses(); | 201 | $status_work = WorkerStatuses::getWorkerStatuses(); |
202 | $Query = Worker::query()->with('users')->with('job_titles') | 202 | $Query = Worker::query()->with('users')->with('job_titles') |
203 | ->with('place_worker')->with('sertificate')->with('prev_company') | 203 | ->with('place_worker')->with('sertificate')->with('prev_company') |
204 | ->with('infobloks')->with('response'); | 204 | ->with('infobloks')->with('response'); |
205 | $Query = $Query->where('id', '=', $worker->id); | 205 | $Query = $Query->where('id', '=', $worker->id); |
206 | $Query = $Query->get(); | 206 | $Query = $Query->get(); |
207 | 207 | ||
208 | $get_date = date('Y.m'); | 208 | $get_date = date('Y.m'); |
209 | 209 | ||
210 | $infoblocks = infobloks::query()->get(); | 210 | $infoblocks = infobloks::query()->get(); |
211 | 211 | ||
212 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 212 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
213 | ->where('user_id', '=', $worker->user_id) | 213 | ->where('user_id', '=', $worker->user_id) |
214 | ->get(); | 214 | ->get(); |
215 | 215 | ||
216 | if ($c->count() > 0) { | 216 | if ($c->count() > 0) { |
217 | $upd = Static_worker::find($c[0]->id); | 217 | $upd = Static_worker::find($c[0]->id); |
218 | $upd->lookin = $upd->lookin + 1; | 218 | $upd->lookin = $upd->lookin + 1; |
219 | $upd->save(); | 219 | $upd->save(); |
220 | } else { | 220 | } else { |
221 | $crt = new Static_worker(); | 221 | $crt = new Static_worker(); |
222 | $crt->lookin = 1; | 222 | $crt->lookin = 1; |
223 | $crt->year_month = $get_date; | 223 | $crt->year_month = $get_date; |
224 | $crt->user_id = $worker->user_id; | 224 | $crt->user_id = $worker->user_id; |
225 | $status = $crt->save(); | 225 | $status = $crt->save(); |
226 | } | 226 | } |
227 | 227 | ||
228 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 228 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
229 | ->where('user_id', '=', $worker->user_id) | 229 | ->where('user_id', '=', $worker->user_id) |
230 | ->get(); | 230 | ->get(); |
231 | 231 | ||
232 | return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat')); | 232 | return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat')); |
233 | } | 233 | } |
234 | 234 | ||
235 | // скачать анкету соискателя | 235 | // скачать анкету соискателя |
236 | public function resume_download(Worker $worker) | 236 | public function resume_download(Worker $worker) |
237 | { | 237 | { |
238 | $status_work = WorkerStatuses::getWorkerStatuses(); | 238 | $status_work = WorkerStatuses::getWorkerStatuses(); |
239 | $Query = Worker::query()->with('users')->with('job_titles') | 239 | $Query = Worker::query()->with('users')->with('job_titles') |
240 | ->with('place_worker')->with('sertificate')->with('prev_company') | 240 | ->with('place_worker')->with('sertificate')->with('prev_company') |
241 | ->with('infobloks'); | 241 | ->with('infobloks'); |
242 | $Query = $Query->where('id', '=', $worker->id); | 242 | $Query = $Query->where('id', '=', $worker->id); |
243 | $Query = $Query->get(); | 243 | $Query = $Query->get(); |
244 | 244 | ||
245 | view()->share('Query',$Query); | 245 | view()->share('Query',$Query); |
246 | 246 | ||
247 | $status_work = WorkerStatuses::getWorkerStatuses(); | 247 | $status_work = WorkerStatuses::getWorkerStatuses(); |
248 | $infoblocks = infobloks::query()->get(); | 248 | $infoblocks = infobloks::query()->get(); |
249 | 249 | ||
250 | //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); | 250 | //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); |
251 | $pdf = PDF::loadView('layout.pdf', [ | 251 | $pdf = PDF::loadView('layout.pdf', [ |
252 | 'Query' => $Query, | 252 | 'Query' => $Query, |
253 | 'status_work' => $status_work, | 253 | 'status_work' => $status_work, |
254 | 'infoblocks' => $infoblocks | 254 | 'infoblocks' => $infoblocks |
255 | ])->setPaper('a4', 'landscape'); | 255 | ])->setPaper('a4', 'landscape'); |
256 | 256 | ||
257 | return $pdf->stream(); | 257 | return $pdf->stream(); |
258 | } | 258 | } |
259 | 259 | ||
260 | public function resume_download_all(Request $request) { | 260 | public function resume_download_all(Request $request) { |
261 | $spreadsheet = new Spreadsheet(); | 261 | $spreadsheet = new Spreadsheet(); |
262 | $sheet = $spreadsheet->getActiveSheet(); | 262 | $sheet = $spreadsheet->getActiveSheet(); |
263 | 263 | ||
264 | $columnMap = range('A', 'Z'); | 264 | $columnMap = range('A', 'Z'); |
265 | $columns = []; | 265 | $columns = []; |
266 | 266 | ||
267 | foreach (DbExportColumns::toArray() as $key => $value){ | 267 | foreach (DbExportColumns::toArray() as $key => $value){ |
268 | if ($request->input($key, 0)){ | 268 | if ($request->input($key, 0)){ |
269 | $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value)); | 269 | $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value)); |
270 | $columns[] = str_replace('__', '.', $key); | 270 | $columns[] = str_replace('__', '.', $key); |
271 | } | 271 | } |
272 | } | 272 | } |
273 | 273 | ||
274 | if (empty($columns)) { | 274 | if (empty($columns)) { |
275 | return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.'); | 275 | return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.'); |
276 | } | 276 | } |
277 | 277 | ||
278 | $query = User::select($columns) | 278 | $query = User::select($columns) |
279 | ->leftJoin('workers', 'users.id', '=', 'workers.user_id') | 279 | ->leftJoin('workers', 'users.id', '=', 'workers.user_id') |
280 | ->leftJoin('job_titles', 'workers.position_work', '=', 'job_titles.id') | 280 | ->leftJoin('job_titles', 'workers.position_work', '=', 'job_titles.id') |
281 | ->where('users.is_bd', '=', 1); | 281 | ->where('users.is_bd', '=', 1); |
282 | 282 | ||
283 | $job_title_list = $request->input('job_title_list', []); | 283 | $job_title_list = $request->input('job_title_list', []); |
284 | if (!empty($job_title_list)){ | 284 | if (!empty($job_title_list)){ |
285 | $query->whereIn('job_titles.id', $job_title_list); | 285 | $query->whereIn('job_titles.id', $job_title_list); |
286 | } | 286 | } |
287 | 287 | ||
288 | $users = $query->get(); | 288 | $users = $query->get(); |
289 | if ($users->count()){ | 289 | if ($users->count()){ |
290 | $i = 2; | 290 | $i = 2; |
291 | foreach ($users->toArray() as $user){ | 291 | foreach ($users->toArray() as $user){ |
292 | $j = 0; | 292 | $j = 0; |
293 | foreach ($user as $field){ | 293 | foreach ($user as $field){ |
294 | $sheet->setCellValue("{$columnMap[$j++]}$i", $field); | 294 | $sheet->setCellValue("{$columnMap[$j++]}$i", $field); |
295 | } | 295 | } |
296 | $i++; | 296 | $i++; |
297 | } | 297 | } |
298 | } | 298 | } |
299 | $writer = new Xlsx($spreadsheet); | 299 | $writer = new Xlsx($spreadsheet); |
300 | $fileName = 'DB.xlsx'; | 300 | $fileName = 'DB.xlsx'; |
301 | 301 | ||
302 | $response = new StreamedResponse(function() use ($writer) { | 302 | $response = new StreamedResponse(function() use ($writer) { |
303 | $writer->save('php://output'); | 303 | $writer->save('php://output'); |
304 | }); | 304 | }); |
305 | 305 | ||
306 | $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); | 306 | $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); |
307 | $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"'); | 307 | $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"'); |
308 | $response->headers->set('Cache-Control', 'max-age=0'); | 308 | $response->headers->set('Cache-Control', 'max-age=0'); |
309 | 309 | ||
310 | return $response; | 310 | return $response; |
311 | } | 311 | } |
312 | 312 | ||
313 | // Кабинет работника | 313 | // Кабинет работника |
314 | public function cabinet(Request $request) | 314 | public function cabinet(Request $request) |
315 | { | 315 | { |
316 | // дата год и месяц | 316 | // дата год и месяц |
317 | $get_date = date('Y.m'); | 317 | $get_date = date('Y.m'); |
318 | 318 | ||
319 | $id = Auth()->user()->id; | 319 | $id = Auth()->user()->id; |
320 | 320 | ||
321 | $Infobloks = infobloks::query()->get(); | 321 | $Infobloks = infobloks::query()->get(); |
322 | 322 | ||
323 | $Worker = Worker::query() | 323 | $Worker = Worker::query() |
324 | ->with(['users', 'sertificate', 'prev_company', 'infobloks', 'place_worker']) | 324 | ->with(['users', 'sertificate', 'prev_company', 'infobloks', 'place_worker']) |
325 | ->WhereHas('users', function (Builder $query) use ($id) { | 325 | ->WhereHas('users', function (Builder $query) use ($id) { |
326 | $query->Where('id', $id); | 326 | $query->Where('id', $id); |
327 | })->first(); | 327 | })->first(); |
328 | 328 | ||
329 | $Job_titles = Job_title::query()->where('is_remove', '=', '0') | 329 | $Job_titles = Job_title::query()->where('is_remove', '=', '0') |
330 | ->where('is_bd', '=' , '1') | 330 | ->where('is_bd', '=' , '1') |
331 | ->OrderByDesc('sort')->OrderBy('name') | 331 | ->OrderByDesc('sort')->OrderBy('name') |
332 | ->get(); | 332 | ->get(); |
333 | 333 | ||
334 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 334 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
335 | ->where('user_id', '=', $id) | 335 | ->where('user_id', '=', $id) |
336 | ->get(); | 336 | ->get(); |
337 | 337 | ||
338 | $persent = Tools::getWorkerProfilePercent($Worker); | 338 | $persent = Tools::getWorkerProfilePercent($Worker); |
339 | 339 | ||
340 | $status_work = WorkerStatuses::getWorkerStatuses(); | 340 | $status_work = WorkerStatuses::getWorkerStatuses(); |
341 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; | 341 | $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; |
342 | $info_blocks = infobloks::query()->OrderBy('name')->get(); | 342 | $info_blocks = infobloks::query()->OrderBy('name')->get(); |
343 | 343 | ||
344 | $worker = Worker::query() | 344 | $worker = Worker::query() |
345 | ->with('users') | 345 | ->with('users') |
346 | ->with('sertificate') | 346 | ->with('sertificate') |
347 | ->with('prev_company') | 347 | ->with('prev_company') |
348 | ->with('infobloks') | 348 | ->with('infobloks') |
349 | ->with('place_worker') | 349 | ->with('place_worker') |
350 | ->with('job_titles') | 350 | ->with('job_titles') |
351 | ->WhereHas('users', function (Builder $query) use ($id) { | 351 | ->WhereHas('users', function (Builder $query) use ($id) { |
352 | $query->Where('id', $id); | 352 | $query->Where('id', $id); |
353 | }) | 353 | }) |
354 | ->first(); | 354 | ->first(); |
355 | if ($worker->dop_info->count()){ | 355 | if ($worker->dop_info->count()){ |
356 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); | 356 | $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); |
357 | } | 357 | } |
358 | 358 | ||
359 | //dd($worker->dop_info); | 359 | //dd($worker->dop_info); |
360 | 360 | ||
361 | if ($request->has('print')) { | 361 | if ($request->has('print')) { |
362 | dd($Worker); | 362 | dd($Worker); |
363 | } else { | 363 | } else { |
364 | return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat', | 364 | return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat', |
365 | 'worker', 'info_blocks', 'status_work', 'additional_document_statuses' | 365 | 'worker', 'info_blocks', 'status_work', 'additional_document_statuses' |
366 | )); | 366 | )); |
367 | } | 367 | } |
368 | } | 368 | } |
369 | 369 | ||
370 | // Сохранение данных | 370 | // Сохранение данных |
371 | public function cabinet_save(Worker $worker, Request $request) | 371 | public function cabinet_save(Worker $worker, Request $request) |
372 | { | 372 | { |
373 | $id = $worker->id; | 373 | $id = $worker->id; |
374 | $params = $request->all(); | 374 | $params = $request->all(); |
375 | $job_title_id = $request->get('job_title_id'); | 375 | $job_title_id = $request->get('job_title_id'); |
376 | 376 | ||
377 | $rules = [ | 377 | $rules = [ |
378 | 'surname' => ['required', 'string', 'max:255'], | 378 | 'surname' => ['required', 'string', 'max:255'], |
379 | 'name_man' => ['required', 'string', 'max:255'], | 379 | 'name_man' => ['required', 'string', 'max:255'], |
380 | 'email' => ['required', 'string', 'email', 'max:255'], | 380 | 'email' => ['required', 'string', 'email', 'max:255'], |
381 | 381 | ||
382 | ]; | 382 | ]; |
383 | 383 | ||
384 | $messages = [ | 384 | $messages = [ |
385 | 'required' => 'Укажите обязательное поле', | 385 | 'required' => 'Укажите обязательное поле', |
386 | 'min' => [ | 386 | 'min' => [ |
387 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 387 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
388 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 388 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
389 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 389 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
390 | ], | 390 | ], |
391 | 'max' => [ | 391 | 'max' => [ |
392 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 392 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
393 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 393 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
394 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 394 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
395 | ] | 395 | ] |
396 | ]; | 396 | ]; |
397 | 397 | ||
398 | $validator = Validator::make($params, $rules, $messages); | 398 | $validator = Validator::make($params, $rules, $messages); |
399 | 399 | ||
400 | if ($validator->fails()) { | 400 | if ($validator->fails()) { |
401 | return redirect()->route('worker.cabinet')->withErrors($validator); | 401 | return redirect()->route('worker.cabinet')->withErrors($validator); |
402 | } else { | 402 | } else { |
403 | 403 | ||
404 | if ($request->has('photo')) { | 404 | if ($request->has('photo')) { |
405 | if (!empty($worker->photo)) { | 405 | if (!empty($worker->photo)) { |
406 | Storage::delete($worker->photo); | 406 | Storage::delete($worker->photo); |
407 | } | 407 | } |
408 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); | 408 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); |
409 | } | 409 | } |
410 | 410 | ||
411 | if ($request->has('file')) { | 411 | if ($request->has('file')) { |
412 | if (!empty($worker->file)) { | 412 | if (!empty($worker->file)) { |
413 | Storage::delete($worker->file); | 413 | Storage::delete($worker->file); |
414 | } | 414 | } |
415 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); | 415 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); |
416 | } | 416 | } |
417 | 417 | ||
418 | $worker->update($params); | 418 | $worker->update($params); |
419 | $use = User::find($worker->user_id); | 419 | $use = User::find($worker->user_id); |
420 | $use->surname = $request->get('surname'); | 420 | $use->surname = $request->get('surname'); |
421 | $use->name_man = $request->get('name_man'); | 421 | $use->name_man = $request->get('name_man'); |
422 | $use->surname2 = $request->get('surname2'); | 422 | $use->surname2 = $request->get('surname2'); |
423 | 423 | ||
424 | $use->save(); | 424 | $use->save(); |
425 | $worker->job_titles()->sync($job_title_id); | 425 | $worker->job_titles()->sync($job_title_id); |
426 | 426 | ||
427 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); | 427 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); |
428 | } | 428 | } |
429 | } | 429 | } |
430 | 430 | ||
431 | public function cabinet_save_foto(Worker $worker, Request $request){ | 431 | public function cabinet_save_foto(Worker $worker, Request $request){ |
432 | $params = ['photo' => null]; | 432 | $params = ['photo' => null]; |
433 | 433 | ||
434 | if ($request->has('photo')) { | 434 | if ($request->has('photo')) { |
435 | if (!empty($worker->photo)) { | 435 | if (!empty($worker->photo)) { |
436 | Storage::delete($worker->photo); | 436 | Storage::delete($worker->photo); |
437 | } | 437 | } |
438 | $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public'); | 438 | $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public'); |
439 | } | 439 | } |
440 | 440 | ||
441 | if ($request->has('file')) { | 441 | if ($request->has('file')) { |
442 | if (!empty($worker->file)) { | 442 | if (!empty($worker->file)) { |
443 | Storage::delete($worker->file); | 443 | Storage::delete($worker->file); |
444 | } | 444 | } |
445 | $params['file'] = $request->file('file')->store("worker/$worker->id", 'public'); | 445 | $params['file'] = $request->file('file')->store("worker/$worker->id", 'public'); |
446 | } | 446 | } |
447 | 447 | ||
448 | $worker->update($params); | 448 | $worker->update($params); |
449 | 449 | ||
450 | return redirect()->route('worker.cabinet'); | 450 | return redirect()->route('worker.cabinet'); |
451 | } | 451 | } |
452 | 452 | ||
453 | // Сообщения данные | 453 | // Сообщения данные |
454 | public function messages($type_message) | 454 | public function messages($type_message) |
455 | { | 455 | { |
456 | $user_id = Auth()->user()->id; | 456 | $user_id = Auth()->user()->id; |
457 | 457 | ||
458 | $chats = Chat::get_user_chats($user_id); | 458 | $chats = Chat::get_user_chats($user_id); |
459 | $admin_chat = Chat::get_user_admin_chat($user_id); | 459 | $admin_chat = Chat::get_user_admin_chat($user_id); |
460 | $user_type = 'worker'; | 460 | $user_type = 'worker'; |
461 | 461 | ||
462 | return view('workers.messages', compact('chats', 'admin_chat','user_id', 'user_type')); | 462 | return view('workers.messages', compact('chats', 'admin_chat','user_id', 'user_type')); |
463 | } | 463 | } |
464 | 464 | ||
465 | // Избранный | 465 | // Избранный |
466 | public function favorite() | 466 | public function favorite() |
467 | { | 467 | { |
468 | return view('workers.favorite'); | 468 | return view('workers.favorite'); |
469 | } | 469 | } |
470 | 470 | ||
471 | // Сменить пароль | 471 | // Сменить пароль |
472 | public function new_password() | 472 | public function new_password() |
473 | { | 473 | { |
474 | $email = Auth()->user()->email; | 474 | $email = Auth()->user()->email; |
475 | return view('workers.new_password', compact('email')); | 475 | return view('workers.new_password', compact('email')); |
476 | } | 476 | } |
477 | 477 | ||
478 | // Обновление пароля | 478 | // Обновление пароля |
479 | public function save_new_password(Request $request) { | 479 | public function save_new_password(Request $request) { |
480 | $use = Auth()->user(); | 480 | $use = Auth()->user(); |
481 | $request->validate([ | 481 | $request->validate([ |
482 | 'password' => 'required|string', | 482 | 'password' => 'required|string', |
483 | 'new_password' => 'required|string', | 483 | 'new_password' => 'required|string', |
484 | 'new_password2' => 'required|string' | 484 | 'new_password2' => 'required|string' |
485 | ]); | 485 | ]); |
486 | 486 | ||
487 | if ($request->get('new_password') == $request->get('new_password2')) | 487 | if ($request->get('new_password') == $request->get('new_password2')) |
488 | if ($request->get('password') !== $request->get('new_password')) { | 488 | if ($request->get('password') !== $request->get('new_password')) { |
489 | $credentials = $request->only('email', 'password'); | 489 | $credentials = $request->only('email', 'password'); |
490 | if (Auth::attempt($credentials, $request->has('save_me'))) { | 490 | if (Auth::attempt($credentials, $request->has('save_me'))) { |
491 | 491 | ||
492 | if (!is_null($use->email_verified_at)){ | 492 | if (!is_null($use->email_verified_at)){ |
493 | 493 | ||
494 | $user_data = User_Model::find($use->id); | 494 | $user_data = User_Model::find($use->id); |
495 | $user_data->update([ | 495 | $user_data->update([ |
496 | 'password' => Hash::make($request->get('new_password')), | 496 | 'password' => Hash::make($request->get('new_password')), |
497 | 'pubpassword' => base64_encode($request->get('new_password')), | 497 | 'pubpassword' => base64_encode($request->get('new_password')), |
498 | ]); | 498 | ]); |
499 | return redirect() | 499 | return redirect() |
500 | ->route('worker.new_password') | 500 | ->route('worker.new_password') |
501 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 501 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
502 | } | 502 | } |
503 | 503 | ||
504 | return redirect() | 504 | return redirect() |
505 | ->route('worker.new_password') | 505 | ->route('worker.new_password') |
506 | ->withError('Данная учетная запись не было верифицированна!'); | 506 | ->withError('Данная учетная запись не было верифицированна!'); |
507 | } | 507 | } |
508 | } | 508 | } |
509 | 509 | ||
510 | return redirect() | 510 | return redirect() |
511 | ->route('worker.new_password') | 511 | ->route('worker.new_password') |
512 | ->withErrors('Не совпадение данных, обновите пароли!'); | 512 | ->withErrors('Не совпадение данных, обновите пароли!'); |
513 | } | 513 | } |
514 | 514 | ||
515 | // Удаление профиля форма | 515 | // Удаление профиля форма |
516 | public function delete_profile() | 516 | public function delete_profile() |
517 | { | 517 | { |
518 | $login = Auth()->user()->email; | 518 | $login = Auth()->user()->email; |
519 | return view('workers.delete_profile', compact('login')); | 519 | return view('workers.delete_profile', compact('login')); |
520 | } | 520 | } |
521 | 521 | ||
522 | // Удаление профиля код | 522 | // Удаление профиля код |
523 | public function delete_profile_result(Request $request) { | 523 | public function delete_profile_result(Request $request) { |
524 | $Answer = $request->all(); | 524 | $Answer = $request->all(); |
525 | $user_id = Auth()->user()->id; | 525 | $user_id = Auth()->user()->id; |
526 | $request->validate([ | 526 | $request->validate([ |
527 | 'password' => 'required|string', | 527 | 'password' => 'required|string', |
528 | ]); | 528 | ]); |
529 | 529 | ||
530 | $credentials = $request->only('email', 'password'); | 530 | $credentials = $request->only('email', 'password'); |
531 | if (Auth::attempt($credentials)) { | 531 | if (Auth::attempt($credentials)) { |
532 | Auth::logout(); | 532 | Auth::logout(); |
533 | $it = User_Model::find($user_id); | 533 | $it = User_Model::find($user_id); |
534 | $it->delete(); | 534 | $it->delete(); |
535 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 535 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
536 | } else { | 536 | } else { |
537 | return redirect()->route('worker.delete_profile') | 537 | return redirect()->route('worker.delete_profile') |
538 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 538 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
539 | } | 539 | } |
540 | } | 540 | } |
541 | 541 | ||
542 | // Регистрация соискателя | 542 | // Регистрация соискателя |
543 | public function register_worker(Request $request) | 543 | public function register_worker(Request $request) |
544 | { | 544 | { |
545 | $params = $request->all(); | 545 | $params = $request->all(); |
546 | $params['is_worker'] = 1; | 546 | $params['is_worker'] = 1; |
547 | 547 | ||
548 | $rules = [ | 548 | $rules = [ |
549 | 'surname' => ['required', 'string', 'max:255'], | 549 | 'surname' => ['required', 'string', 'max:255'], |
550 | 'name_man' => ['required', 'string', 'max:255'], | 550 | 'name_man' => ['required', 'string', 'max:255'], |
551 | 'email' => ['required', 'email', 'max:255', 'unique:users'], | 551 | 'email' => ['required', 'email', 'max:255', 'unique:users'], |
552 | 'password' => ['required', 'string', 'min:6'] | 552 | 'password' => ['required', 'string', 'min:6'] |
553 | ]; | 553 | ]; |
554 | 554 | ||
555 | $messages = [ | 555 | $messages = [ |
556 | 'required' => 'Укажите обязательное поле', | 556 | 'required' => 'Укажите обязательное поле', |
557 | 'min' => [ | 557 | 'min' => [ |
558 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 558 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
559 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 559 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
560 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 560 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
561 | ], | 561 | ], |
562 | 'max' => [ | 562 | 'max' => [ |
563 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 563 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
564 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 564 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
565 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 565 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
566 | ] | 566 | ] |
567 | ]; | 567 | ]; |
568 | 568 | ||
569 | $email = $request->get('email'); | 569 | $email = $request->get('email'); |
570 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 570 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
571 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 571 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
572 | } | 572 | } |
573 | 573 | ||
574 | if ($request->get('password') !== $request->get('confirmed')){ | 574 | if ($request->get('password') !== $request->get('confirmed')){ |
575 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 575 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
576 | } | 576 | } |
577 | 577 | ||
578 | if (strlen($request->get('password')) < 6) { | 578 | if (strlen($request->get('password')) < 6) { |
579 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 579 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
580 | } | 580 | } |
581 | 581 | ||
582 | /*$haystack = $request->get('password'); | 582 | /*$haystack = $request->get('password'); |
583 | 583 | ||
584 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 584 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
585 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 585 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
586 | 'X', 'C', 'V', 'B', 'N', 'M'); | 586 | 'X', 'C', 'V', 'B', 'N', 'M'); |
587 | $lenpwd_bool = true; | 587 | $lenpwd_bool = true; |
588 | $spec_bool = false; | 588 | $spec_bool = false; |
589 | $alpha_bool = false; | 589 | $alpha_bool = false; |
590 | 590 | ||
591 | if (strlen($haystack) < 8) $lenpwd_bool = false; | 591 | if (strlen($haystack) < 8) $lenpwd_bool = false; |
592 | 592 | ||
593 | foreach ($specsumbol as $it) { | 593 | foreach ($specsumbol as $it) { |
594 | if (strpos($haystack, $it) !== false) { | 594 | if (strpos($haystack, $it) !== false) { |
595 | $spec_bool = true; | 595 | $spec_bool = true; |
596 | } | 596 | } |
597 | } | 597 | } |
598 | 598 | ||
599 | foreach ($alpha as $it) { | 599 | foreach ($alpha as $it) { |
600 | if (strpos($haystack, $it) !== false) { | 600 | if (strpos($haystack, $it) !== false) { |
601 | $alpha_bool = true; | 601 | $alpha_bool = true; |
602 | } | 602 | } |
603 | } | 603 | } |
604 | 604 | ||
605 | if ((!$spec_bool) || (!$alpha_bool)) { | 605 | if ((!$spec_bool) || (!$alpha_bool)) { |
606 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 606 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
607 | }*/ | 607 | }*/ |
608 | 608 | ||
609 | if (($request->has('politik')) && ($request->get('politik') == 1)) { | 609 | if (($request->has('politik')) && ($request->get('politik') == 1)) { |
610 | $validator = Validator::make($params, $rules, $messages); | 610 | $validator = Validator::make($params, $rules, $messages); |
611 | 611 | ||
612 | if ($validator->fails()) { | 612 | if ($validator->fails()) { |
613 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 613 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
614 | } else { | 614 | } else { |
615 | //dd($params); | 615 | //dd($params); |
616 | $user = $this->create($params); | 616 | $user = $this->create($params); |
617 | event(new Registered($user)); | 617 | event(new Registered($user)); |
618 | Auth::guard()->login($user); | 618 | Auth::guard()->login($user); |
619 | } | 619 | } |
620 | if ($user) { | 620 | if ($user) { |
621 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; | 621 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; |
622 | } else { | 622 | } else { |
623 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 623 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
624 | } | 624 | } |
625 | 625 | ||
626 | } else { | 626 | } else { |
627 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); | 627 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); |
628 | } | 628 | } |
629 | } | 629 | } |
630 | 630 | ||
631 | // Звездная оценка и ответ | 631 | // Звездная оценка и ответ |
632 | public function stars_answer(Request $request) { | 632 | public function stars_answer(Request $request) { |
633 | $params = $request->all(); | 633 | $params = $request->all(); |
634 | $rules = [ | 634 | $rules = [ |
635 | 'message' => ['required', 'string', 'max:255'], | 635 | 'message' => ['required', 'string', 'max:255'], |
636 | ]; | 636 | ]; |
637 | 637 | ||
638 | $messages = [ | 638 | $messages = [ |
639 | 'required' => 'Укажите обязательное поле', | 639 | 'required' => 'Укажите обязательное поле', |
640 | 'min' => [ | 640 | 'min' => [ |
641 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 641 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
642 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 642 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
643 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 643 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
644 | ], | 644 | ], |
645 | 'max' => [ | 645 | 'max' => [ |
646 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 646 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
647 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 647 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
648 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 648 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
649 | ] | 649 | ] |
650 | ]; | 650 | ]; |
651 | $response_worker = ResponseWork::create($params); | 651 | $response_worker = ResponseWork::create($params); |
652 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); | 652 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); |
653 | } | 653 | } |
654 | 654 | ||
655 | public function TestWorker() | 655 | public function TestWorker() |
656 | { | 656 | { |
657 | $Use = new User(); | 657 | $Use = new User(); |
658 | 658 | ||
659 | $Code_user = $Use->create([ | 659 | $Code_user = $Use->create([ |
660 | 'name' => 'surname name_man', | 660 | 'name' => 'surname name_man', |
661 | 'name_man' => 'name_man', | 661 | 'name_man' => 'name_man', |
662 | 'surname' => 'surname', | 662 | 'surname' => 'surname', |
663 | 'surname2' => 'surname2', | 663 | 'surname2' => 'surname2', |
664 | 'subscribe_email' => '1', | 664 | 'subscribe_email' => '1', |
665 | 'email' => 'email@mail.com', | 665 | 'email' => 'email@mail.com', |
666 | 'telephone' => '1234567890', | 666 | 'telephone' => '1234567890', |
667 | 'password' => Hash::make('password'), | 667 | 'password' => Hash::make('password'), |
668 | 'pubpassword' => base64_encode('password'), | 668 | 'pubpassword' => base64_encode('password'), |
669 | 'email_verified_at' => Carbon::now(), | 669 | 'email_verified_at' => Carbon::now(), |
670 | 'is_worker' => 1, | 670 | 'is_worker' => 1, |
671 | ]); | 671 | ]); |
672 | 672 | ||
673 | if ($Code_user->id > 0) { | 673 | if ($Code_user->id > 0) { |
674 | $Worker = new Worker(); | 674 | $Worker = new Worker(); |
675 | $Worker->user_id = $Code_user->id; | 675 | $Worker->user_id = $Code_user->id; |
676 | $Worker->position_work = 1; //'job_titles'; | 676 | $Worker->position_work = 1; //'job_titles'; |
677 | $Worker->email = 'email@email.com'; | 677 | $Worker->email = 'email@email.com'; |
678 | $Worker->telephone = '1234567890'; | 678 | $Worker->telephone = '1234567890'; |
679 | $status = $Worker->save(); | 679 | $status = $Worker->save(); |
680 | 680 | ||
681 | $Title_Worker = new Title_worker(); | 681 | $Title_Worker = new Title_worker(); |
682 | $Title_Worker->worker_id = $Worker->id; | 682 | $Title_Worker->worker_id = $Worker->id; |
683 | $Title_Worker->job_title_id = 1; | 683 | $Title_Worker->job_title_id = 1; |
684 | $Title_Worker->save(); | 684 | $Title_Worker->save(); |
685 | } | 685 | } |
686 | } | 686 | } |
687 | 687 | ||
688 | // Создание пользователя | 688 | // Создание пользователя |
689 | protected function create(array $data) | 689 | protected function create(array $data) |
690 | { | 690 | { |
691 | $Use = new User(); | 691 | $Use = new User(); |
692 | 692 | ||
693 | $Code_user = $Use->create([ | 693 | $Code_user = $Use->create([ |
694 | 'name' => $data['surname']." ".$data['name_man'], | 694 | 'name' => $data['surname']." ".$data['name_man'], |
695 | 'name_man' => $data['name_man'], | 695 | 'name_man' => $data['name_man'], |
696 | 'surname' => $data['surname'], | 696 | 'surname' => $data['surname'], |
697 | 'surname2' => $data['surname2'], | 697 | 'surname2' => $data['surname2'], |
698 | 'subscribe_email' => $data['email'], | 698 | 'subscribe_email' => $data['email'], |
699 | 'email' => $data['email'], | 699 | 'email' => $data['email'], |
700 | 'telephone' => $data['telephone'], | 700 | 'telephone' => $data['telephone'], |
701 | 'password' => Hash::make($data['password']), | 701 | 'password' => Hash::make($data['password']), |
702 | 'pubpassword' => base64_encode($data['password']), | 702 | 'pubpassword' => base64_encode($data['password']), |
703 | 'email_verified_at' => Carbon::now(), | 703 | 'email_verified_at' => Carbon::now(), |
704 | 'is_worker' => $data['is_worker'], | 704 | 'is_worker' => $data['is_worker'], |
705 | ]); | 705 | ]); |
706 | 706 | ||
707 | if ($Code_user->id > 0) { | 707 | if ($Code_user->id > 0) { |
708 | $Worker = new Worker(); | 708 | $Worker = new Worker(); |
709 | $Worker->user_id = $Code_user->id; | 709 | $Worker->user_id = $Code_user->id; |
710 | $Worker->position_work = $data['job_titles']; | 710 | $Worker->position_work = $data['job_titles']; |
711 | $Worker->email = $data['email']; | 711 | $Worker->email = $data['email']; |
712 | $Worker->telephone = $data['telephone']; | 712 | $Worker->telephone = $data['telephone']; |
713 | $Worker->save(); | 713 | $Worker->save(); |
714 | 714 | ||
715 | if (isset($Worker->id)) { | 715 | if (isset($Worker->id)) { |
716 | $Title_Worker = new Title_worker(); | 716 | $Title_Worker = new Title_worker(); |
717 | $Title_Worker->worker_id = $Worker->id; | 717 | $Title_Worker->worker_id = $Worker->id; |
718 | $Title_Worker->job_title_id = $data['job_titles']; | 718 | $Title_Worker->job_title_id = $data['job_titles']; |
719 | $Title_Worker->save(); | 719 | $Title_Worker->save(); |
720 | } | 720 | } |
721 | 721 | ||
722 | return $Code_user; | 722 | return $Code_user; |
723 | } | 723 | } |
724 | } | 724 | } |
725 | 725 | ||
726 | // Вакансии избранные | 726 | // Вакансии избранные |
727 | public function colorado(Request $request) { | 727 | public function colorado(Request $request) { |
728 | $IP_address = RusDate::ip_addr_client(); | 728 | $IP_address = RusDate::ip_addr_client(); |
729 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 729 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
730 | 730 | ||
731 | if ($Arr->count()) { | 731 | if ($Arr->count()) { |
732 | $A = Array(); | 732 | $A = Array(); |
733 | foreach ($Arr as $it) { | 733 | foreach ($Arr as $it) { |
734 | $A[] = $it->code_record; | 734 | $A[] = $it->code_record; |
735 | } | 735 | } |
736 | 736 | ||
737 | $Query = Ad_employer::query()->whereIn('id', $A); | 737 | $Query = Ad_employer::query()->whereIn('id', $A); |
738 | } else { | 738 | } else { |
739 | $Query = Ad_employer::query()->where('id', '=', '0'); | 739 | $Query = Ad_employer::query()->where('id', '=', '0'); |
740 | } | 740 | } |
741 | 741 | ||
742 | $Query = $Query->with(['jobs', 'cat', 'employer']) | 742 | $Query = $Query->with(['jobs', 'cat', 'employer']) |
743 | ->whereHas('jobs_code', function ($query) use ($request) { | 743 | ->whereHas('jobs_code', function ($query) use ($request) { |
744 | if ($request->ajax()) { | 744 | if ($request->ajax()) { |
745 | if (null !== ($request->get('job'))) { | 745 | if (null !== ($request->get('job'))) { |
746 | $query->where('job_title_id', $request->get('job')); | 746 | $query->where('job_title_id', $request->get('job')); |
747 | } | 747 | } |
748 | } | 748 | } |
749 | }) | 749 | }) |
750 | ->select('ad_employers.*'); | 750 | ->select('ad_employers.*'); |
751 | 751 | ||
752 | if ($request->get('search') !== null) { | 752 | if ($request->get('search') !== null) { |
753 | $search = $request->get('search'); | 753 | $search = $request->get('search'); |
754 | $Query->where('name', 'LIKE', "%$search%"); | 754 | $Query->where('name', 'LIKE', "%$search%"); |
755 | } | 755 | } |
756 | 756 | ||
757 | //dd($Query->get()); | 757 | //dd($Query->get()); |
758 | 758 | ||
759 | $Job_title = Job_title::query()->OrderBy('name')->get(); | 759 | $Job_title = Job_title::query()->OrderBy('name')->get(); |
760 | 760 | ||
761 | $Query_count = $Query->count(); | 761 | $Query_count = $Query->count(); |
762 | 762 | ||
763 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 763 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
764 | 764 | ||
765 | return view('workers.favorite', compact('Query', | 765 | return view('workers.favorite', compact('Query', |
766 | 'Query_count', | 766 | 'Query_count', |
767 | 'Job_title')); | 767 | 'Job_title')); |
768 | 768 | ||
769 | } | 769 | } |
770 | 770 | ||
771 | //Переписка | 771 | //Переписка |
772 | public function dialog(Chat $chat, Request $request) { | 772 | public function dialog(Chat $chat, Request $request) { |
773 | // Получение параметров. | 773 | // Получение параметров. |
774 | if ($request->has('ad_employer')){ | 774 | if ($request->has('ad_employer')){ |
775 | $ad_employer = $request->get('ad_employer'); | 775 | $ad_employer = $request->get('ad_employer'); |
776 | } else { | 776 | } else { |
777 | $ad_employer = 0; | 777 | $ad_employer = 0; |
778 | } | 778 | } |
779 | 779 | ||
780 | $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); | 780 | $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); |
781 | $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); | 781 | $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); |
782 | 782 | ||
783 | $Messages = Chat::get_chat_messages($chat); | 783 | $Messages = Chat::get_chat_messages($chat); |
784 | 784 | ||
785 | Message::where('chat_id_to', '=', $chat->id)->update(['flag_new' => 0]); | 785 | Message::where('chat_id_to', '=', $chat->id)->update(['flag_new' => 0]); |
786 | 786 | ||
787 | return view('workers.dialog', compact('companion', 'sender', 'chat', 'Messages', 'ad_employer')); | 787 | return view('workers.dialog', compact('companion', 'sender', 'chat', 'Messages', 'ad_employer')); |
788 | } | 788 | } |
789 | 789 | ||
790 | // Даунылоады | 790 | // Даунылоады |
791 | public function download(Worker $worker) { | 791 | public function download(Worker $worker) { |
792 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; | 792 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; |
793 | view()->share('house',$arr_house); | 793 | view()->share('house',$arr_house); |
794 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); | 794 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); |
795 | return $pdf->stream(); | 795 | return $pdf->stream(); |
796 | } | 796 | } |
797 | 797 | ||
798 | // Поднятие анкеты | 798 | // Поднятие анкеты |
799 | public function up(Worker $worker) { | 799 | public function up(Worker $worker) { |
800 | $worker->updated_at = Carbon::now(); | 800 | $worker->updated_at = Carbon::now(); |
801 | $worker->save(); | 801 | $worker->save(); |
802 | // 0 | 802 | // 0 |
803 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); | 803 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); |
804 | } | 804 | } |
805 | 805 | ||
806 | // Форма сертификате | 806 | // Форма сертификате |
807 | public function new_sertificate(Worker $worker) { | 807 | public function new_sertificate(Worker $worker) { |
808 | return view('workers.sertificate_add', compact('worker')); | 808 | return view('workers.sertificate_add', compact('worker')); |
809 | } | 809 | } |
810 | 810 | ||
811 | // Добавление сертификата | 811 | // Добавление сертификата |
812 | public function add_serificate(SertificationRequest $request) { | 812 | public function add_serificate(SertificationRequest $request) { |
813 | $request->validate([ | 813 | $request->validate([ |
814 | 'name' => 'required|string|max:255', | 814 | 'name' => 'required|string|max:255', |
815 | 'end_begin' => 'required|date|date_format:d.m.Y' | 815 | 'end_begin' => 'required|date|date_format:d.m.Y' |
816 | ], | 816 | ], |
817 | [ | 817 | [ |
818 | 'name' => 'Навание сертификата обязательно для заполнения.', | 818 | 'name' => 'Навание сертификата обязательно для заполнения.', |
819 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' | 819 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' |
820 | ]); | 820 | ]); |
821 | 821 | ||
822 | $params = $request->all(); | 822 | $params = $request->all(); |
823 | 823 | ||
824 | $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']); | 824 | $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']); |
825 | $params['end_begin'] = $end_begin->format('Y-m-d'); | 825 | $params['end_begin'] = $end_begin->format('Y-m-d'); |
826 | 826 | ||
827 | $Sertificate = new sertification(); | 827 | $Sertificate = new sertification(); |
828 | $Sertificate->create($params); | 828 | $Sertificate->create($params); |
829 | 829 | ||
830 | return response()->json([ | 830 | return response()->json([ |
831 | 'success' => true | 831 | 'success' => true |
832 | ]); | 832 | ]); |
833 | } | 833 | } |
834 | 834 | ||
835 | // Удалить сертификат | 835 | // Удалить сертификат |
836 | public function delete_sertificate(sertification $doc) { | 836 | public function delete_sertificate(sertification $doc) { |
837 | $doc->delete(); | 837 | $doc->delete(); |
838 | 838 | ||
839 | return redirect()->route('worker.cabinet'); | 839 | return redirect()->route('worker.cabinet'); |
840 | } | 840 | } |
841 | 841 | ||
842 | // Редактирование сертификата | 842 | // Редактирование сертификата |
843 | public function edit_sertificate(Worker $worker, sertification $doc) { | 843 | public function edit_sertificate(Worker $worker, sertification $doc) { |
844 | return view('workers.sertificate_edit', compact('doc', 'worker')); | 844 | return view('workers.sertificate_edit', compact('doc', 'worker')); |
845 | } | 845 | } |
846 | 846 | ||
847 | // Редактирование обновление сертификата | 847 | // Редактирование обновление сертификата |
848 | public function update_serificate(SertificationRequest $request, sertification $doc) { | 848 | public function update_serificate(SertificationRequest $request, sertification $doc) { |
849 | $request->validate([ | 849 | $request->validate([ |
850 | 'name' => 'required|string|max:255', | 850 | 'name' => 'required|string|max:255', |
851 | 'end_begin' => 'required|date|date_format:d.m.Y' | 851 | 'end_begin' => 'required|date|date_format:d.m.Y' |
852 | ], | 852 | ], |
853 | [ | 853 | [ |
854 | 'name' => 'Навание сертификата обязательно для заполнения.', | 854 | 'name' => 'Навание сертификата обязательно для заполнения.', |
855 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' | 855 | 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' |
856 | ]); | 856 | ]); |
857 | 857 | ||
858 | $all = $request->all(); | 858 | $all = $request->all(); |
859 | 859 | ||
860 | $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']); | 860 | $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']); |
861 | $all['end_begin'] = $end_begin->format('Y-m-d'); | 861 | $all['end_begin'] = $end_begin->format('Y-m-d'); |
862 | 862 | ||
863 | $doc->worker_id = $all['worker_id']; | 863 | $doc->worker_id = $all['worker_id']; |
864 | $doc->name = $all['name']; | 864 | $doc->name = $all['name']; |
865 | $doc->end_begin = $all['end_begin']; | 865 | $doc->end_begin = $all['end_begin']; |
866 | $doc->save(); | 866 | $doc->save(); |
867 | 867 | ||
868 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 868 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
869 | } | 869 | } |
870 | 870 | ||
871 | public function edit_diploms(Request $request, Worker $worker) { | 871 | public function edit_diploms(Request $request, Worker $worker) { |
872 | $dop_info_data = $request->input('diploms'); | 872 | $dop_info_data = $request->input('diploms'); |
873 | 873 | ||
874 | if (empty($dop_info_data)) { | 874 | if (empty($dop_info_data)) { |
875 | return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!'); | 875 | return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!'); |
876 | } | 876 | } |
877 | 877 | ||
878 | foreach ($dop_info_data as $infoblok_id => $status) { | 878 | foreach ($dop_info_data as $infoblok_id => $status) { |
879 | Dop_info::updateOrCreate( | 879 | Dop_info::updateOrCreate( |
880 | ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id], | 880 | ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id], |
881 | ['status' => $status] | 881 | ['status' => $status] |
882 | ); | 882 | ); |
883 | } | 883 | } |
884 | 884 | ||
885 | return redirect()->route('worker.additional_documents')->with('success', 'Успешно сохранено!'); | 885 | return redirect()->route('worker.additional_documents')->with('success', 'Успешно сохранено!'); |
886 | } | 886 | } |
887 | 887 | ||
888 | public function delete_add_diplom(Request $request, Worker $worker) { | 888 | public function delete_add_diplom(Request $request, Worker $worker) { |
889 | $infoblok_id = $request->get('infoblok_id'); | 889 | $infoblok_id = $request->get('infoblok_id'); |
890 | 890 | ||
891 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) | 891 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) |
892 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); | 892 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); |
893 | else { | 893 | else { |
894 | $params['infoblok_id'] = $infoblok_id; | 894 | $params['infoblok_id'] = $infoblok_id; |
895 | $params['worker_id'] = $worker->id; | 895 | $params['worker_id'] = $worker->id; |
896 | $params['status'] = $request->get('val'); | 896 | $params['status'] = $request->get('val'); |
897 | $id = Dop_info::create($params); | 897 | $id = Dop_info::create($params); |
898 | //$id = $worker->infobloks()->sync([$infoblok_id]); | 898 | //$id = $worker->infobloks()->sync([$infoblok_id]); |
899 | } | 899 | } |
900 | 900 | ||
901 | //$Infoblocks = infobloks::query()->get(); | 901 | //$Infoblocks = infobloks::query()->get(); |
902 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); | 902 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); |
903 | } | 903 | } |
904 | 904 | ||
905 | 905 | ||
906 | 906 | ||
907 | // Добавление диплома | 907 | // Добавление диплома |
908 | public function add_diplom_ajax(Request $request) { | 908 | public function add_diplom_ajax(Request $request) { |
909 | // конец | 909 | // конец |
910 | $params = $request->all(); | 910 | $params = $request->all(); |
911 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 911 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
912 | 912 | ||
913 | if ($count == 0) $dop_info = Dop_info::create($params); | 913 | if ($count == 0) $dop_info = Dop_info::create($params); |
914 | $Infoblocks = infobloks::query()->get(); | 914 | $Infoblocks = infobloks::query()->get(); |
915 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); | 915 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); |
916 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); | 916 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); |
917 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); | 917 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); |
918 | } | 918 | } |
919 | 919 | ||
920 | // Добавление диплома без ajax | 920 | // Добавление диплома без ajax |
921 | public function add_diplom(Worker $worker) { | 921 | public function add_diplom(Worker $worker) { |
922 | $worker_id = $worker->id; | 922 | $worker_id = $worker->id; |
923 | $Infoblocks = infobloks::query()->get(); | 923 | $Infoblocks = infobloks::query()->get(); |
924 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); | 924 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); |
925 | } | 925 | } |
926 | // Сохранить | 926 | // Сохранить |
927 | // Сохраняю диплом | 927 | // Сохраняю диплом |
928 | public function add_diplom_save(Request $request) { | 928 | public function add_diplom_save(Request $request) { |
929 | $params = $request->all(); | 929 | $params = $request->all(); |
930 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 930 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
931 | if ($count == 0) $dop_info = Dop_info::create($params); | 931 | if ($count == 0) $dop_info = Dop_info::create($params); |
932 | return redirect()->route('worker.cabinet'); | 932 | return redirect()->route('worker.cabinet'); |
933 | } | 933 | } |
934 | 934 | ||
935 | // Добавление стандартного документа | 935 | // Добавление стандартного документа |
936 | public function add_document(Worker $worker) { | 936 | public function add_document(Worker $worker) { |
937 | return view('workers.docs', compact('worker')); | 937 | return view('workers.docs', compact('worker')); |
938 | } | 938 | } |
939 | 939 | ||
940 | //Сохранение стандартого документа | 940 | //Сохранение стандартого документа |
941 | public function add_document_save(DocumentsRequest $request) { | 941 | public function add_document_save(DocumentsRequest $request) { |
942 | $params = $request->all(); | 942 | $params = $request->all(); |
943 | place_works::create($params); | 943 | place_works::create($params); |
944 | return response()->json(['success' => true]); | 944 | return response()->json(['success' => true]); |
945 | } | 945 | } |
946 | 946 | ||
947 | // Редактирование документа | 947 | // Редактирование документа |
948 | public function edit_document(place_works $doc, Worker $worker) { | 948 | public function edit_document(place_works $doc, Worker $worker) { |
949 | return view('workers.docs-edit', compact('doc', 'worker')); | 949 | return view('workers.docs-edit', compact('doc', 'worker')); |
950 | } | 950 | } |
951 | 951 | ||
952 | //Сохранение отредактированного документа | 952 | //Сохранение отредактированного документа |
953 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { | 953 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { |
954 | $params = $request->all(); | 954 | $params = $request->all(); |
955 | $doc->update($params); | 955 | $doc->update($params); |
956 | 956 | ||
957 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 957 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
958 | } | 958 | } |
959 | 959 | ||
960 | // Удаление документа | 960 | // Удаление документа |
961 | public function delete_document(place_works $doc) { | 961 | public function delete_document(place_works $doc) { |
962 | $doc->delete(); | 962 | $doc->delete(); |
963 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 963 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
964 | } | 964 | } |
965 | 965 | ||
966 | //Отправка нового сообщения | 966 | //Отправка нового сообщения |
967 | public function new_message(Request $request) { | 967 | public function new_message(Request $request) |
968 | { | ||
968 | $params = $request->all(); | 969 | $params = $request->all(); |
969 | 970 | ||
970 | $id = $params['send_user_id']; | 971 | $id = $params['_user_id']; |
971 | $message_params = [ | 972 | $message_params = [ |
972 | 'title' => $params['send_title'], | 973 | 'title' => $params['title'], |
973 | 'text' => $params['send_text'], | 974 | 'text' => $params['text'], |
974 | 'ad_employer_id' => $params['send_vacancy'], | 975 | 'ad_employer_id' => $params['_vacancy'], |
975 | 'flag_new' => 1 | 976 | 'flag_new' => 1 |
976 | ]; | 977 | ]; |
977 | 978 | ||
978 | $message = Message::add_message( | 979 | $message = Message::add_message( |
979 | $request, | 980 | $request, |
980 | $params['send_user_id'], | 981 | $params['_user_id'], |
981 | $params['send_to_user_id'], | 982 | $params['_to_user_id'], |
982 | $message_params, | 983 | $message_params, |
983 | file_store_path: "worker/$id" | 984 | file_store_path: "worker/$id" |
984 | ); | 985 | ); |
985 | 986 | ||
986 | $data['message_id'] = $message->id; | 987 | $data['message_id'] = $message->id; |
987 | $data['ad_employer_id'] = $params['send_vacancy']; | 988 | $data['ad_employer_id'] = $params['_vacancy']; |
988 | $data['job_title_id'] = $params['send_job_title_id']; | 989 | //$data['job_title_id'] = $params['_job_title_id']; |
989 | $data['flag'] = 1; | 990 | $data['flag'] = 1; |
990 | $ad_responce = ad_response::create($data); | 991 | ad_response::create($data); |
991 | return redirect()->route('worker.messages', ['type_message' => 'output']); | 992 | return redirect()->route('worker.dialog', ['chat' => $message->chat_id_from]); |
992 | } | 993 | } |
993 | 994 | ||
994 | 995 | ||
995 | public function test123(Request $request) { | 996 | public function test123(Request $request) { |
996 | $params = $request->all(); | 997 | $params = $request->all(); |
997 | $user1 = $params['user_id']; | 998 | $user1 = $params['user_id']; |
998 | $user2 = $params['to_user_id']; | 999 | $user2 = $params['to_user_id']; |
999 | 1000 | ||
1000 | $rules = [ | 1001 | $rules = [ |
1001 | 'text' => 'nullable|required_without:file|min:1|max:150000', | 1002 | 'text' => 'nullable|required_without:file|min:1|max:150000', |
1002 | 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 1003 | 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
1003 | ]; | 1004 | ]; |
1004 | $messages = [ | 1005 | $messages = [ |
1005 | 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', | 1006 | 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', |
1006 | 'min' => [ | 1007 | 'min' => [ |
1007 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 1008 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
1008 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 1009 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
1009 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 1010 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
1010 | ], | 1011 | ], |
1011 | 'max' => [ | 1012 | 'max' => [ |
1012 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 1013 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
1013 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 1014 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
1014 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 1015 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
1015 | ] | 1016 | ] |
1016 | ]; | 1017 | ]; |
1017 | 1018 | ||
1018 | $validator = Validator::make($request->all(), $rules, $messages); | 1019 | $validator = Validator::make($request->all(), $rules, $messages); |
1019 | 1020 | ||
1020 | if ($validator->fails()) { | 1021 | if ($validator->fails()) { |
1021 | $chat = Chat::where('user_id', $user1) | 1022 | $chat = Chat::where('user_id', $user1) |
1022 | ->where('to_user_id', $user2) | 1023 | ->where('to_user_id', $user2) |
1023 | ->where('is_removed', 0) | 1024 | ->where('is_removed', 0) |
1024 | ->first() | 1025 | ->first() |
1025 | ; | 1026 | ; |
1026 | 1027 | ||
1027 | if ($chat->id){ | 1028 | if ($chat->id){ |
1028 | return redirect()->route('worker.dialog', ['chat' => $chat->id])->withErrors($validator); | 1029 | return redirect()->route('worker.dialog', ['chat' => $chat->id])->withErrors($validator); |
1029 | } else { | 1030 | } else { |
1030 | return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); | 1031 | return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); |
1031 | } | 1032 | } |
1032 | } else { | 1033 | } else { |
1033 | $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); | 1034 | $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); |
1034 | 1035 | ||
1035 | return redirect()->route('worker.dialog', ['chat' => $new_message->chat_id_from]); | 1036 | return redirect()->route('worker.dialog', ['chat' => $new_message->chat_id_from]); |
1036 | 1037 | ||
1037 | } | 1038 | } |
1038 | } | 1039 | } |
1039 | 1040 | ||
1040 | // Информация о предыдущих компаниях | 1041 | // Информация о предыдущих компаниях |
1041 | public function new_prev_company(Worker $worker) { | 1042 | public function new_prev_company(Worker $worker) { |
1042 | return view('workers.prev_company_form', compact('worker')); | 1043 | return view('workers.prev_company_form', compact('worker')); |
1043 | } | 1044 | } |
1044 | 1045 | ||
1045 | // Добавление контакта компании | 1046 | // Добавление контакта компании |
1046 | public function add_prev_company(PrevCompanyRequest $request) { | 1047 | public function add_prev_company(PrevCompanyRequest $request) { |
1047 | // Возвращение параметров | 1048 | // Возвращение параметров |
1048 | $all = $request->all(); | 1049 | $all = $request->all(); |
1049 | PrevCompany::create($all); | 1050 | PrevCompany::create($all); |
1050 | 1051 | ||
1051 | return response()->json(['success' => true]); | 1052 | return response()->json(['success' => true]); |
1052 | } | 1053 | } |
1053 | 1054 | ||
1054 | // Редактирование контакта компании | 1055 | // Редактирование контакта компании |
1055 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { | 1056 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { |
1056 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); | 1057 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); |
1057 | } | 1058 | } |
1058 | 1059 | ||
1059 | //Сохранение редактирования контакта компании | 1060 | //Сохранение редактирования контакта компании |
1060 | public function update_prev_company(PrevCompany $doc, Request $request){ | 1061 | public function update_prev_company(PrevCompany $doc, Request $request){ |
1061 | $all = $request->all(); | 1062 | $all = $request->all(); |
1062 | $doc->update($all); | 1063 | $doc->update($all); |
1063 | 1064 | ||
1064 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 1065 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
1065 | } | 1066 | } |
1066 | 1067 | ||
1067 | // Удаление контакта предыдущей компании | 1068 | // Удаление контакта предыдущей компании |
1068 | public function delete_prev_company(PrevCompany $doc) { | 1069 | public function delete_prev_company(PrevCompany $doc) { |
1069 | $doc->delete(); | 1070 | $doc->delete(); |
1070 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 1071 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
1071 | } | 1072 | } |
1072 | } | 1073 | } |
1073 | 1074 | ||
1074 | 1075 |
app/Models/Message.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
6 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
7 | use Illuminate\Http\Request; | 7 | use Illuminate\Http\Request; |
8 | use Illuminate\Support\Facades\Validator; | 8 | use Illuminate\Support\Facades\Validator; |
9 | use mysql_xdevapi\Collection; | 9 | use mysql_xdevapi\Collection; |
10 | 10 | ||
11 | class Message extends Model | 11 | class Message extends Model |
12 | { | 12 | { |
13 | use HasFactory; | 13 | use HasFactory; |
14 | 14 | ||
15 | protected $fillable = [ | 15 | protected $fillable = [ |
16 | 'user_id', | 16 | 'user_id', |
17 | 'to_user_id', | 17 | 'to_user_id', |
18 | 'title', | 18 | 'title', |
19 | 'text', | 19 | 'text', |
20 | 'file', | 20 | 'file', |
21 | 'flag_new', | 21 | 'flag_new', |
22 | 'ad_employer_id', | 22 | 'ad_employer_id', |
23 | 'job_title_id', | 23 | 'job_title_id', |
24 | 'chat_id_from', | 24 | 'chat_id_from', |
25 | 'chat_id_to', | 25 | 'chat_id_to', |
26 | 'reply_message_id', | 26 | 'reply_message_id', |
27 | 'original_file_name', | 27 | 'original_file_name', |
28 | ]; | 28 | ]; |
29 | 29 | ||
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Связь таблицы Message с таблицей User (Отправитель) | 32 | * Связь таблицы Message с таблицей User (Отправитель) |
33 | */ | 33 | */ |
34 | public function user_from() { | 34 | public function user_from() { |
35 | return $this->belongsTo(User::class, 'user_id'); | 35 | return $this->belongsTo(User::class, 'user_id'); |
36 | } | 36 | } |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * Связь таблицы Message с таблицей User (Получатель) | 39 | * Связь таблицы Message с таблицей User (Получатель) |
40 | */ | 40 | */ |
41 | public function user_to() { | 41 | public function user_to() { |
42 | return $this->belongsTo(User::class, 'to_user_id'); | 42 | return $this->belongsTo(User::class, 'to_user_id'); |
43 | } | 43 | } |
44 | 44 | ||
45 | // Связь модели Сообщения (Message) с моделью Вакансии (Ad_employer) | 45 | // Связь модели Сообщения (Message) с моделью Вакансии (Ad_employer) |
46 | public function vacancies() { | 46 | public function vacancies() { |
47 | return $this->belongsTo(Ad_employer::class, 'ad_employer_id', 'id'); | 47 | return $this->belongsTo(Ad_employer::class, 'ad_employer_id', 'id'); |
48 | } | 48 | } |
49 | 49 | ||
50 | public static function add_message( | 50 | public static function add_message( |
51 | ?Request $request, | 51 | ?Request $request, |
52 | int $user_id, | 52 | int $user_id, |
53 | int $to_user_id, | 53 | int $to_user_id, |
54 | array $message_params, | 54 | array $message_params, |
55 | string $file_store_path = '/', | 55 | string $file_store_path = '/', |
56 | bool $is_admin_chat = false | 56 | bool $is_admin_chat = false |
57 | ) { | 57 | ) { |
58 | dd($request->all()); | ||
59 | $message_params['user_id'] = $user_id; | 58 | $message_params['user_id'] = $user_id; |
60 | $message_params['to_user_id'] = $to_user_id; | 59 | $message_params['to_user_id'] = $to_user_id; |
61 | if ($request && $request->has('file')) { | 60 | if ($request && $request->has('file')) { |
62 | $file = $request->file('file'); | 61 | $file = $request->file('file'); |
63 | $message_params['file'] = $file->store($file_store_path, 'public'); | 62 | $message_params['file'] = $file->store($file_store_path, 'public'); |
64 | $message_params['original_file_name'] = $file->getClientOriginalName(); | 63 | $message_params['original_file_name'] = $file->getClientOriginalName(); |
65 | } | 64 | } |
66 | 65 | ||
67 | $chat_form = Chat::firstOrCreate([ | 66 | $chat_form = Chat::firstOrCreate([ |
68 | 'user_id' => $is_admin_chat ? 0 : $user_id, | 67 | 'user_id' => $is_admin_chat ? 0 : $user_id, |
69 | 'to_user_id' => $to_user_id, | 68 | 'to_user_id' => $to_user_id, |
70 | 'is_removed' => 0, | 69 | 'is_removed' => 0, |
71 | 'is_admin_chat' => $is_admin_chat ? 1 : 0, | 70 | 'is_admin_chat' => $is_admin_chat ? 1 : 0, |
72 | ]); | 71 | ]); |
73 | $message_params[$is_admin_chat ? 'chat_id_to' : 'chat_id_from'] = $chat_form->id; | 72 | $message_params[$is_admin_chat ? 'chat_id_to' : 'chat_id_from'] = $chat_form->id; |
74 | 73 | ||
75 | if (!$is_admin_chat) { | 74 | if (!$is_admin_chat) { |
76 | $chat_to = Chat::firstOrCreate([ | 75 | $chat_to = Chat::firstOrCreate([ |
77 | 'user_id' => $to_user_id, | 76 | 'user_id' => $to_user_id, |
78 | 'to_user_id' => $user_id, | 77 | 'to_user_id' => $user_id, |
79 | 'is_removed' => 0 | 78 | 'is_removed' => 0 |
80 | ]); | 79 | ]); |
81 | $message_params['chat_id_to'] = $chat_to->id; | 80 | $message_params['chat_id_to'] = $chat_to->id; |
82 | } | 81 | } |
83 | 82 | ||
84 | $new_message = Message::create($message_params); | 83 | $new_message = Message::create($message_params); |
85 | 84 | ||
86 | if (!empty($new_message->id)) { | 85 | if (!empty($new_message->id)) { |
87 | $chat_form->update(['last_message_date' => date("Y-m-d H:i:s"), 'last_message_id' => $new_message->id]); | 86 | $chat_form->update(['last_message_date' => date("Y-m-d H:i:s"), 'last_message_id' => $new_message->id]); |
88 | 87 | ||
89 | if (!$is_admin_chat) { | 88 | if (!$is_admin_chat) { |
90 | $chat_to->update(['last_message_date' => date("Y-m-d H:i:s"), 'last_message_id' => $new_message->id]); | 89 | $chat_to->update(['last_message_date' => date("Y-m-d H:i:s"), 'last_message_id' => $new_message->id]); |
91 | } | 90 | } |
92 | } | 91 | } |
93 | 92 | ||
94 | return $new_message ?? false; | 93 | return $new_message ?? false; |
95 | } | 94 | } |
96 | 95 | ||
97 | public function getReplyMessageAttribute() | 96 | public function getReplyMessageAttribute() |
98 | { | 97 | { |
99 | $reply_message = false; | 98 | $reply_message = false; |
100 | if ($this->attributes['reply_message_id']){ | 99 | if ($this->attributes['reply_message_id']){ |
101 | $reply_message = self::find($this->attributes['reply_message_id']); | 100 | $reply_message = self::find($this->attributes['reply_message_id']); |
102 | } | 101 | } |
103 | 102 | ||
104 | return $reply_message; | 103 | return $reply_message; |
105 | } | 104 | } |
106 | 105 | ||
107 | } | 106 | } |
108 | 107 |
resources/views/modals/send_message_low_profile_percent.blade.php
1 | <div id="ask_percent" class="modal modal_bg"> | 1 | <div id="ask_percent" class="modal modal_bg"> |
2 | <div style="display:none"> | 2 | <div style="display:none"> |
3 | <!-- Отправитель сообщения: --> | 3 | <!-- Отправитель сообщения: --> |
4 | <input type="hidden" id="modal_user_id" name="_user_id" class="input" placeholder="user_id" value=""> | 4 | <input type="hidden" id="modal_user_id" name="_user_id" class="input" placeholder="user_id" value=""> |
5 | <!-- Получатель сообщения: --> | 5 | <!-- Получатель сообщения: --> |
6 | <input type="hidden" id="modal_to_user_id" name="_to_user_id" class="input" placeholder="to_user_id" value=""> | 6 | <input type="hidden" id="modal_to_user_id" name="_to_user_id" class="input" placeholder="to_user_id" value=""> |
7 | <!-- Вакансия: --> | 7 | <!-- Вакансия: --> |
8 | <input type="hidden" id="modal_vacancy" name="_vacancy" class="input" placeholder="vacancy" value=""> | 8 | <input type="hidden" id="modal_vacancy" name="_vacancy" class="input" placeholder="vacancy" value=""> |
9 | </div> | 9 | </div> |
10 | 10 | ||
11 | <div class="modal__body"> | 11 | <div class="modal__body"> |
12 | <div class="modal__title">Вы откликнулись на вакансию <span id="vac_name"></span></div> | 12 | <div class="modal__title">Вы откликнулись на вакансию <span id="vac_name"></span></div> |
13 | <div class="modal__text">Ваше резюме заполнено менее чем на 50%</div> | 13 | <div class="modal__text">Ваше резюме заполнено менее чем на 50%</div> |
14 | <div class="modal__text">Вы хотите дополнить ваше резюме?</div> | 14 | <div class="modal__text">Вы хотите дополнить ваше резюме?</div> |
15 | <div class="modal__buttons"> | 15 | <div class="modal__buttons"> |
16 | <a href="{{ route('worker.cabinet') }}" class="button main__employer-page-two-item-button">Да</a> | 16 | <a href="{{ route('worker.cabinet') }}" class="button main__employer-page-two-item-button">Да</a> |
17 | <button type="button" | 17 | <button type="button" |
18 | data-fancybox | 18 | data-fancybox |
19 | data-src="#send2" | 19 | data-src="#send2" |
20 | {{--data-vacancy="{{ $Q->id }}" | 20 | {{--data-vacancy="{{ $Q->id }}" |
21 | data-uid="{{ $uid }}" | 21 | data-uid="{{ $uid }}" |
22 | data-tuid="{{ $Q->employer->user_id }}"--}} | 22 | data-tuid="{{ $Q->employer->user_id }}"--}} |
23 | data-options='{"touch":false,"autoFocus":false}' | 23 | data-options='{"touch":false,"autoFocus":false}' |
24 | class="button main__employer-page-two-item-button js_send_wp_button">Нет</button> | 24 | class="button main__employer-page-two-item-button js_send_wp_button">Нет</button> |
25 | </div> | 25 | </div> |
26 | </div> | 26 | </div> |
27 | </div> | 27 | </div> |
28 | 28 | ||
29 | <script> | 29 | <script> |
30 | $(document).on('change', '#modal_user_id', function () { | 30 | $(document).on('change', '#modal_user_id', function () { |
31 | $('.js_send_wp_button').data('uid', $('#modal_user_id').val()); | 31 | $('.js_send_wp_button').data('uid', $('#modal_user_id').val()); |
32 | }) | 32 | }) |
33 | $(document).on('change', '#modal_to_user_id', function () { | 33 | $(document).on('change', '#modal_to_user_id', function () { |
34 | $('.js_send_wp_button').data('tuid', $('#modal_to_user_id').val()); | 34 | $('.js_send_wp_button').data('tuid', $('#modal_to_user_id').val()); |
35 | }) | 35 | }) |
36 | $(document).on('change', '#modal_vacancy', function () { | 36 | $(document).on('change', '#modal_vacancy', function () { |
37 | $('.js_send_wp_button').data('vacancy', $('#modal_vacancy').val()); | 37 | $('.js_send_wp_button').data('vacancy', $('#modal_vacancy').val()); |
38 | $.ajax({ | 38 | $.ajax({ |
39 | url: 'vacancy/'+$('#modal_vacancy').val(), | 39 | url: 'vacancy/'+$('#modal_vacancy').val(), |
40 | type: 'GET', | 40 | type: 'GET', |
41 | dataType: "json", | 41 | dataType: "json", |
42 | success: function (data) { | 42 | success: function (data) { |
43 | $('#vac_name').html(data.name) | 43 | $('#vac_name').html(data.name) |
44 | } | 44 | } |
45 | }) | 45 | }) |
46 | }) | 46 | }) |
47 | 47 | ||
48 | $(document).on('click', '.js_send_wp_button', function() { | 48 | $(document).on('click', '.js_send_wp_button', function() { |
49 | $('#_to_user_id').val($(this).data('tuid')); | 49 | $('#_to_user_id').val($(this).data('tuid')); |
50 | $('#_vacancy').val($(this).data('vacancy')); | 50 | $('#_vacancy').val($(this).data('vacancy')); |
51 | $('#_user_id').val($(this).data('uid')); | 51 | $('#_user_id').val($(this).data('uid')); |
52 | |||
53 | console.log($(this).data('uid'), $('#_user_id')) | ||
54 | //console.log($('#_to_user_id')) | ||
55 | //console.log($('#_vacancy')) | ||
56 | }); | 52 | }); |
57 | 53 | ||
58 | </script> | 54 | </script> |
59 | 55 |
routes/web.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use App\Http\Controllers\Ad_jobsController; | 3 | use App\Http\Controllers\Ad_jobsController; |
4 | use App\Http\Controllers\AdEmployerController; | 4 | use App\Http\Controllers\AdEmployerController; |
5 | use App\Http\Controllers\Admin\AdminController; | 5 | use App\Http\Controllers\Admin\AdminController; |
6 | use App\Http\Controllers\Admin\CategoryController; | 6 | use App\Http\Controllers\Admin\CategoryController; |
7 | use App\Http\Controllers\Admin\CategoryEmpController; | 7 | use App\Http\Controllers\Admin\CategoryEmpController; |
8 | use App\Http\Controllers\Admin\EducationController; | 8 | use App\Http\Controllers\Admin\EducationController; |
9 | use App\Http\Controllers\EducationController as EducationFrontController; | 9 | use App\Http\Controllers\EducationController as EducationFrontController; |
10 | use App\Http\Controllers\Admin\EmployersController; | 10 | use App\Http\Controllers\Admin\EmployersController; |
11 | use App\Http\Controllers\EmployerController as FrontEmployersController; | 11 | use App\Http\Controllers\EmployerController as FrontEmployersController; |
12 | use App\Http\Controllers\Admin\InfoBloksController; | 12 | use App\Http\Controllers\Admin\InfoBloksController; |
13 | use App\Http\Controllers\Admin\JobTitlesController; | 13 | use App\Http\Controllers\Admin\JobTitlesController; |
14 | use App\Http\Controllers\Admin\UsersController; | 14 | use App\Http\Controllers\Admin\UsersController; |
15 | use App\Http\Controllers\Admin\WorkersController; | 15 | use App\Http\Controllers\Admin\WorkersController; |
16 | use App\Http\Controllers\Auth\ForgotPasswordController; | 16 | use App\Http\Controllers\Auth\ForgotPasswordController; |
17 | use App\Http\Controllers\Auth\LoginController; | 17 | use App\Http\Controllers\Auth\LoginController; |
18 | use App\Http\Controllers\Auth\RegisterController; | 18 | use App\Http\Controllers\Auth\RegisterController; |
19 | use App\Http\Controllers\CKEditorController; | 19 | use App\Http\Controllers\CKEditorController; |
20 | use App\Http\Controllers\FaqController; | 20 | use App\Http\Controllers\FaqController; |
21 | use App\Http\Controllers\MediaController; | 21 | use App\Http\Controllers\MediaController; |
22 | use App\Http\Controllers\WorkerController; | 22 | use App\Http\Controllers\WorkerController; |
23 | use App\Models\Ad_jobs; | 23 | use App\Models\Ad_jobs; |
24 | use App\Models\User; | 24 | use App\Models\User; |
25 | use App\Http\Controllers\MainController; | 25 | use App\Http\Controllers\MainController; |
26 | use App\Http\Controllers\HomeController; | 26 | use App\Http\Controllers\HomeController; |
27 | use Illuminate\Support\Facades\Route; | 27 | use Illuminate\Support\Facades\Route; |
28 | use App\Http\Controllers\Admin\CompanyController; | 28 | use App\Http\Controllers\Admin\CompanyController; |
29 | use App\Http\Controllers\Admin\Ad_EmployersController; | 29 | use App\Http\Controllers\Admin\Ad_EmployersController; |
30 | use App\Http\Controllers\Admin\MsgAnswersController; | 30 | use App\Http\Controllers\Admin\MsgAnswersController; |
31 | use App\Http\Controllers\Admin\GroupsController; | 31 | use App\Http\Controllers\Admin\GroupsController; |
32 | use App\Http\Controllers\PagesController; | 32 | use App\Http\Controllers\PagesController; |
33 | use Illuminate\Support\Facades\Storage; | 33 | use Illuminate\Support\Facades\Storage; |
34 | use App\Http\Controllers\EmployerController; | 34 | use App\Http\Controllers\EmployerController; |
35 | use App\Http\Controllers\CompanyController as FrontCompanyController; | 35 | use App\Http\Controllers\CompanyController as FrontCompanyController; |
36 | 36 | ||
37 | 37 | ||
38 | /* | 38 | /* |
39 | |-------------------------------------------------------------------------- | 39 | |-------------------------------------------------------------------------- |
40 | | Web Routes | 40 | | Web Routes |
41 | |-------------------------------------------------------------------------- | 41 | |-------------------------------------------------------------------------- |
42 | | | 42 | | |
43 | | Here is where you can register web routes for your application. These | 43 | | Here is where you can register web routes for your application. These |
44 | | routes are loaded by the RouteServiceProvider within a group which | 44 | | routes are loaded by the RouteServiceProvider within a group which |
45 | | contains the "web" middleware group. Now create something great! | 45 | | contains the "web" middleware group. Now create something great! |
46 | | | 46 | | |
47 | */ | 47 | */ |
48 | /* | 48 | /* |
49 | Route::get('/', function () { | 49 | Route::get('/', function () { |
50 | return view('welcome'); | 50 | return view('welcome'); |
51 | })->name('index'); | 51 | })->name('index'); |
52 | */ | 52 | */ |
53 | 53 | ||
54 | Route::get('/', [MainController::class, 'index'])->name('index'); | 54 | Route::get('/', [MainController::class, 'index'])->name('index'); |
55 | 55 | ||
56 | //Роуты авторизации, регистрации, восстановления, аутентификации | 56 | //Роуты авторизации, регистрации, восстановления, аутентификации |
57 | Auth::routes(['verify' => true]); | 57 | Auth::routes(['verify' => true]); |
58 | 58 | ||
59 | // роуты регистрации, авторизации, восстановления пароля, верификации почты | 59 | // роуты регистрации, авторизации, восстановления пароля, верификации почты |
60 | /*Route::group([ | 60 | /*Route::group([ |
61 | 'as' => 'auth.', //имя маршрута, например auth.index | 61 | 'as' => 'auth.', //имя маршрута, например auth.index |
62 | 'prefix' => 'auth', // префикс маршрута, например, auth/index | 62 | 'prefix' => 'auth', // префикс маршрута, например, auth/index |
63 | ], function () { | 63 | ], function () { |
64 | //форма регистрации | 64 | //форма регистрации |
65 | Route::get('register', [RegisterController::class, 'register'])->name('register'); | 65 | Route::get('register', [RegisterController::class, 'register'])->name('register'); |
66 | 66 | ||
67 | //создание пользователя | 67 | //создание пользователя |
68 | Route::post('register', [RegisterController::class, 'create'])->name('create'); | 68 | Route::post('register', [RegisterController::class, 'create'])->name('create'); |
69 | 69 | ||
70 | //форма входа авторизации | 70 | //форма входа авторизации |
71 | Route::get('login', [LoginController::class, 'login'])->name('login'); | 71 | Route::get('login', [LoginController::class, 'login'])->name('login'); |
72 | 72 | ||
73 | //аутентификация | 73 | //аутентификация |
74 | Route::post('login', [LoginController::class, 'authenticate'])->name('auth'); | 74 | Route::post('login', [LoginController::class, 'authenticate'])->name('auth'); |
75 | 75 | ||
76 | //выход | 76 | //выход |
77 | Route::get('logout', [LoginController::class, 'logout'])->name('logout'); | 77 | Route::get('logout', [LoginController::class, 'logout'])->name('logout'); |
78 | 78 | ||
79 | //форма ввода адреса почты | 79 | //форма ввода адреса почты |
80 | Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form'); | 80 | Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form'); |
81 | 81 | ||
82 | //письмо на почту | 82 | //письмо на почту |
83 | Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail'); | 83 | Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail'); |
84 | 84 | ||
85 | //форма восстановления пароля | 85 | //форма восстановления пароля |
86 | Route::get('reset-password/token/{token}/email/{email}', | 86 | Route::get('reset-password/token/{token}/email/{email}', |
87 | [ResetPasswordController::class, 'form'] | 87 | [ResetPasswordController::class, 'form'] |
88 | )->name('reset-form'); | 88 | )->name('reset-form'); |
89 | 89 | ||
90 | //восстановление пароля | 90 | //восстановление пароля |
91 | Route::post('reset-password', | 91 | Route::post('reset-password', |
92 | [ResetPasswordController::class, 'reset'] | 92 | [ResetPasswordController::class, 'reset'] |
93 | )->name('reset-password'); | 93 | )->name('reset-password'); |
94 | 94 | ||
95 | //сообщение о необходимости проверки адреса почты | 95 | //сообщение о необходимости проверки адреса почты |
96 | Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message'); | 96 | Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message'); |
97 | 97 | ||
98 | //подтверждение адреса почты нового пользователя | 98 | //подтверждение адреса почты нового пользователя |
99 | Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify']) | 99 | Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify']) |
100 | ->where('token', '[a-f0-9]{32}') | 100 | ->where('token', '[a-f0-9]{32}') |
101 | ->where('id', '[0-9]+') | 101 | ->where('id', '[0-9]+') |
102 | ->name('verify-email'); | 102 | ->name('verify-email'); |
103 | });*/ | 103 | });*/ |
104 | 104 | ||
105 | //Личный кабинет пользователя | 105 | //Личный кабинет пользователя |
106 | Route::get('/home', [HomeController::class, 'index'])->name('home'); | 106 | Route::get('/home', [HomeController::class, 'index'])->name('home'); |
107 | 107 | ||
108 | /* | 108 | /* |
109 | Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { | 109 | Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { |
110 | $user = User::where('email',$request->input('email'))->first(); | 110 | $user = User::where('email',$request->input('email'))->first(); |
111 | 111 | ||
112 | $user->sendEmailVerificationNotification(); | 112 | $user->sendEmailVerificationNotification(); |
113 | 113 | ||
114 | return 'your response'; | 114 | return 'your response'; |
115 | })->middleware('throttle:6,1')->name('verification.resend'); | 115 | })->middleware('throttle:6,1')->name('verification.resend'); |
116 | */ | 116 | */ |
117 | 117 | ||
118 | // Авторизация, регистрация в админку | 118 | // Авторизация, регистрация в админку |
119 | Route::group([ | 119 | Route::group([ |
120 | 'as' => 'admin.', // имя маршрута, например auth.index | 120 | 'as' => 'admin.', // имя маршрута, например auth.index |
121 | 'prefix' => 'admin', // префикс маршрута, например auth/index | 121 | 'prefix' => 'admin', // префикс маршрута, например auth/index |
122 | 'middleware' => ['guest'], | 122 | 'middleware' => ['guest'], |
123 | ], function () { | 123 | ], function () { |
124 | // Форма регистрации | 124 | // Форма регистрации |
125 | Route::get('register', [AdminController::class, 'register'])->name('register'); | 125 | Route::get('register', [AdminController::class, 'register'])->name('register'); |
126 | // Создание пользователя | 126 | // Создание пользователя |
127 | Route::post('register', [AdminController::class, 'create'])->name('create'); | 127 | Route::post('register', [AdminController::class, 'create'])->name('create'); |
128 | 128 | ||
129 | //Форма входа | 129 | //Форма входа |
130 | Route::get('login', [AdminController::class, 'login'])->name('login'); | 130 | Route::get('login', [AdminController::class, 'login'])->name('login'); |
131 | 131 | ||
132 | // аутентификация | 132 | // аутентификация |
133 | Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); | 133 | Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); |
134 | 134 | ||
135 | }); | 135 | }); |
136 | 136 | ||
137 | // Личный кабинет админки | 137 | // Личный кабинет админки |
138 | Route::group([ | 138 | Route::group([ |
139 | 'as' => 'admin.', // имя маршрута, например auth.index | 139 | 'as' => 'admin.', // имя маршрута, например auth.index |
140 | 'prefix' => 'admin', // префикс маршрута, например auth/index | 140 | 'prefix' => 'admin', // префикс маршрута, например auth/index |
141 | 'middleware' => ['auth', 'admin'], | 141 | 'middleware' => ['auth', 'admin'], |
142 | ], function() { | 142 | ], function() { |
143 | 143 | ||
144 | // выход | 144 | // выход |
145 | Route::get('logout', [AdminController::class, 'logout'])->name('logout'); | 145 | Route::get('logout', [AdminController::class, 'logout'])->name('logout'); |
146 | 146 | ||
147 | // кабинет главная страница | 147 | // кабинет главная страница |
148 | Route::get('cabinet', [AdminController::class, 'index'])->name('index'); | 148 | Route::get('cabinet', [AdminController::class, 'index'])->name('index'); |
149 | Route::get('/', function () { | 149 | Route::get('/', function () { |
150 | return redirect()->route('admin.index'); | 150 | return redirect()->route('admin.index'); |
151 | }); | 151 | }); |
152 | 152 | ||
153 | // кабинет профиль админа - форма | 153 | // кабинет профиль админа - форма |
154 | Route::get('profile', [AdminController::class, 'profile'])->name('profile'); | 154 | Route::get('profile', [AdminController::class, 'profile'])->name('profile'); |
155 | // кабинет профиль админа - сохранение формы | 155 | // кабинет профиль админа - сохранение формы |
156 | Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); | 156 | Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); |
157 | 157 | ||
158 | //кабинет сообщения админа | 158 | //кабинет сообщения админа |
159 | //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); | 159 | //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); |
160 | 160 | ||
161 | 161 | ||
162 | // кабинет профиль - форма пароли | 162 | // кабинет профиль - форма пароли |
163 | Route::get('password', [AdminController::class, 'profile_password'])->name('password'); | 163 | Route::get('password', [AdminController::class, 'profile_password'])->name('password'); |
164 | // кабинет профиль - сохранение формы пароля | 164 | // кабинет профиль - сохранение формы пароля |
165 | Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); | 165 | Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); |
166 | 166 | ||
167 | 167 | ||
168 | // кабинет профиль пользователя - форма | 168 | // кабинет профиль пользователя - форма |
169 | Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); | 169 | Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); |
170 | // кабинет профиль пользователя - сохранение формы | 170 | // кабинет профиль пользователя - сохранение формы |
171 | Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); | 171 | Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); |
172 | 172 | ||
173 | // кабинет профиль работодатель - форма | 173 | // кабинет профиль работодатель - форма |
174 | Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); | 174 | Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); |
175 | // кабинет профиль работодатель - сохранение формы | 175 | // кабинет профиль работодатель - сохранение формы |
176 | Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); | 176 | Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); |
177 | // кабинет удаление профиль работодателя и юзера | 177 | // кабинет удаление профиль работодателя и юзера |
178 | Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); | 178 | Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); |
179 | 179 | ||
180 | // кабинет профиль работник - форма | 180 | // кабинет профиль работник - форма |
181 | Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); | 181 | Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); |
182 | Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); | 182 | Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); |
183 | Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); | 183 | Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); |
184 | // кабинет профиль работник - сохранение формы | 184 | // кабинет профиль работник - сохранение формы |
185 | Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); | 185 | Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); |
186 | 186 | ||
187 | // Медиа | 187 | // Медиа |
188 | Route::get('media', [MediaController::class, 'index'])->name('media'); | 188 | Route::get('media', [MediaController::class, 'index'])->name('media'); |
189 | Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); | 189 | Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); |
190 | 190 | ||
191 | // кабинет настройки сайта - форма | 191 | // кабинет настройки сайта - форма |
192 | Route::get('config', [AdminController::class, 'config_form'])->name('config'); | 192 | Route::get('config', [AdminController::class, 'config_form'])->name('config'); |
193 | // кабинет настройки сайта сохранение формы | 193 | // кабинет настройки сайта сохранение формы |
194 | Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); | 194 | Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); |
195 | 195 | ||
196 | // кабинет - новости | 196 | // кабинет - новости |
197 | Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin'); | 197 | Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin'); |
198 | Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add'); | 198 | Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add'); |
199 | Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add'); | 199 | Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add'); |
200 | Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit'); | 200 | Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit'); |
201 | Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update'); | 201 | Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update'); |
202 | Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete'); | 202 | Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete'); |
203 | 203 | ||
204 | // кабинет - пользователи | 204 | // кабинет - пользователи |
205 | Route::get('users', [UsersController::class, 'index'])->name('users'); | 205 | Route::get('users', [UsersController::class, 'index'])->name('users'); |
206 | Route::get('user-delete/{user}', [UsersController::class, 'user_delete'])->name('user_delete'); | 206 | Route::get('user-delete/{user}', [UsersController::class, 'user_delete'])->name('user_delete'); |
207 | 207 | ||
208 | // кабинет - пользователи | 208 | // кабинет - пользователи |
209 | Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); | 209 | Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); |
210 | 210 | ||
211 | // кабинет - работодатели | 211 | // кабинет - работодатели |
212 | Route::get('employers', [EmployersController::class, 'index'])->name('employers'); | 212 | Route::get('employers', [EmployersController::class, 'index'])->name('employers'); |
213 | 213 | ||
214 | Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer'); | 214 | Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer'); |
215 | 215 | ||
216 | Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add'); | 216 | Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add'); |
217 | Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save'); | 217 | Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save'); |
218 | Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot'); | 218 | Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot'); |
219 | Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit'); | 219 | Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit'); |
220 | Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete'); | 220 | Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete'); |
221 | 221 | ||
222 | // кабинет - соискатели | 222 | // кабинет - соискатели |
223 | Route::get('workers', [WorkersController::class, 'index'])->name('workers'); | 223 | Route::get('workers', [WorkersController::class, 'index'])->name('workers'); |
224 | 224 | ||
225 | // кабинет - база данных | 225 | // кабинет - база данных |
226 | Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata'); | 226 | Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata'); |
227 | Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata'); | 227 | Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata'); |
228 | Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata'); | 228 | Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata'); |
229 | Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata'); | 229 | Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata'); |
230 | Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata'); | 230 | Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata'); |
231 | Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata'); | 231 | Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata'); |
232 | Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata'); | 232 | Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata'); |
233 | 233 | ||
234 | // кабинет - вакансии | 234 | // кабинет - вакансии |
235 | Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); | 235 | Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); |
236 | Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers'); | 236 | Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers'); |
237 | Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers'); | 237 | Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers'); |
238 | Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); | 238 | Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); |
239 | Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); | 239 | Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); |
240 | Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer'); | 240 | Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer'); |
241 | 241 | ||
242 | // Редактирование должности в вакансии | 242 | // Редактирование должности в вакансии |
243 | Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs'); | 243 | Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs'); |
244 | Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs'); | 244 | Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs'); |
245 | 245 | ||
246 | 246 | ||
247 | // кабинет - категории | 247 | // кабинет - категории |
248 | //Route::get('categories', [AdminController::class, 'index'])->name('categories'); | 248 | //Route::get('categories', [AdminController::class, 'index'])->name('categories'); |
249 | 249 | ||
250 | // СRUD-операции над Справочником Категории | 250 | // СRUD-операции над Справочником Категории |
251 | 251 | ||
252 | Route::resource('categories', CategoryController::class, ['except' => ['show']]); | 252 | Route::resource('categories', CategoryController::class, ['except' => ['show']]); |
253 | 253 | ||
254 | // CRUD-операции над справочником Категории для работодателей | 254 | // CRUD-операции над справочником Категории для работодателей |
255 | Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]); | 255 | Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]); |
256 | 256 | ||
257 | // CRUD-операции над справочником Образование | 257 | // CRUD-операции над справочником Образование |
258 | Route::resource('education', EducationController::class, ['except' => ['show']]); | 258 | Route::resource('education', EducationController::class, ['except' => ['show']]); |
259 | 259 | ||
260 | Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education'); | 260 | Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education'); |
261 | Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); | 261 | Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); |
262 | Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); | 262 | Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); |
263 | 263 | ||
264 | Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education'); | 264 | Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education'); |
265 | Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education'); | 265 | Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education'); |
266 | 266 | ||
267 | Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education'); | 267 | Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education'); |
268 | 268 | ||
269 | /* | 269 | /* |
270 | * кабинет - CRUD-операции по справочнику должности | 270 | * кабинет - CRUD-операции по справочнику должности |
271 | * | 271 | * |
272 | */ | 272 | */ |
273 | Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); | 273 | Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); |
274 | 274 | ||
275 | // кабинет - сообщения (чтение чужих) | 275 | // кабинет - сообщения (чтение чужих) |
276 | Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); | 276 | Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); |
277 | // кабинет - просмотр сообщения чужого (чтение) | 277 | // кабинет - просмотр сообщения чужого (чтение) |
278 | Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message'); | 278 | Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message'); |
279 | 279 | ||
280 | // кабинет - сообщения (админские) | 280 | // кабинет - сообщения (админские) |
281 | Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); | 281 | Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); |
282 | // кабинет - сообщения (админские) | 282 | // кабинет - сообщения (админские) |
283 | Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); | 283 | Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); |
284 | // кабинет - sql - конструкция запросов | 284 | // кабинет - sql - конструкция запросов |
285 | Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql'); | 285 | Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql'); |
286 | 286 | ||
287 | Route::post('admin-reject-message', [MsgAnswersController::class, 'reject_message'])->name('reject_message'); | 287 | Route::post('admin-reject-message', [MsgAnswersController::class, 'reject_message'])->name('reject_message'); |
288 | Route::post('admin-send-message', [MsgAnswersController::class, 'send_message'])->name('send_message'); | 288 | Route::post('admin-send-message', [MsgAnswersController::class, 'send_message'])->name('send_message'); |
289 | 289 | ||
290 | /* | 290 | /* |
291 | * Расписанный подход в описании каждой директорий групп пользователей. | 291 | * Расписанный подход в описании каждой директорий групп пользователей. |
292 | */ | 292 | */ |
293 | // кабинет - группы пользователей | 293 | // кабинет - группы пользователей |
294 | Route::get('groups', [GroupsController::class, 'index'])->name('groups'); | 294 | Route::get('groups', [GroupsController::class, 'index'])->name('groups'); |
295 | // кабинет - добавление форма группы пользователей | 295 | // кабинет - добавление форма группы пользователей |
296 | Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); | 296 | Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); |
297 | // кабинет - сохранение формы группы пользователей | 297 | // кабинет - сохранение формы группы пользователей |
298 | Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); | 298 | Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); |
299 | // кабинет - редактирование форма группы пользователей | 299 | // кабинет - редактирование форма группы пользователей |
300 | Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); | 300 | Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); |
301 | // кабинет - сохранение редактированной формы группы пользователей | 301 | // кабинет - сохранение редактированной формы группы пользователей |
302 | Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); | 302 | Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); |
303 | // кабинет - удаление группы пользователей | 303 | // кабинет - удаление группы пользователей |
304 | Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); | 304 | Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); |
305 | 305 | ||
306 | 306 | ||
307 | // кабинет - список админов | 307 | // кабинет - список админов |
308 | Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); | 308 | Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); |
309 | 309 | ||
310 | // справочник Позиции | 310 | // справочник Позиции |
311 | Route::get('positions', [AdminController::class, 'position'])->name('position'); | 311 | Route::get('positions', [AdminController::class, 'position'])->name('position'); |
312 | Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position'); | 312 | Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position'); |
313 | Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position'); | 313 | Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position'); |
314 | Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position'); | 314 | Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position'); |
315 | Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position'); | 315 | Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position'); |
316 | Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position'); | 316 | Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position'); |
317 | 317 | ||
318 | /////редактор////// кабинет - редактор сайта//////////////////////// | 318 | /////редактор////// кабинет - редактор сайта//////////////////////// |
319 | Route::get('editor-site', function() { | 319 | Route::get('editor-site', function() { |
320 | return view('admin.editor.index'); | 320 | return view('admin.editor.index'); |
321 | })->name('editor-site'); | 321 | })->name('editor-site'); |
322 | 322 | ||
323 | 323 | ||
324 | // кабинет - редактор шапки-футера сайта | 324 | // кабинет - редактор шапки-футера сайта |
325 | Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); | 325 | Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); |
326 | Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); | 326 | Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); |
327 | Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); | 327 | Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); |
328 | Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); | 328 | Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); |
329 | Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); | 329 | Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); |
330 | Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); | 330 | Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); |
331 | Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); | 331 | Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); |
332 | 332 | ||
333 | 333 | ||
334 | // кабинет - редактор должности на главной | 334 | // кабинет - редактор должности на главной |
335 | Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); | 335 | Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); |
336 | 336 | ||
337 | // кабинет - счетчики на главной | 337 | // кабинет - счетчики на главной |
338 | Route::get('counters-main', [CompanyController::class, 'counters_main'])->name('counters-main'); | 338 | Route::get('counters-main', [CompanyController::class, 'counters_main'])->name('counters-main'); |
339 | Route::post('counters-main/edit/{name}', [CompanyController::class, 'counters_main_update'])->name('counters-main-update'); | 339 | Route::post('counters-main/edit/{name}', [CompanyController::class, 'counters_main_update'])->name('counters-main-update'); |
340 | 340 | ||
341 | // кабинет - редактор работодатели на главной | 341 | // кабинет - редактор работодатели на главной |
342 | Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); | 342 | Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); |
343 | Route::post('employers-main-add', [CompanyController::class, 'employers_main_add'])->name('employers-main-add'); | 343 | Route::post('employers-main-add', [CompanyController::class, 'employers_main_add'])->name('employers-main-add'); |
344 | Route::post('employers-main-remove', [CompanyController::class, 'employers_main_remove'])->name('employers-main-remove'); | 344 | Route::post('employers-main-remove', [CompanyController::class, 'employers_main_remove'])->name('employers-main-remove'); |
345 | 345 | ||
346 | 346 | ||
347 | // кабинет - редактор seo-сайта | 347 | // кабинет - редактор seo-сайта |
348 | Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); | 348 | Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); |
349 | Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); | 349 | Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); |
350 | Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); | 350 | Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); |
351 | Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); | 351 | Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); |
352 | Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); | 352 | Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); |
353 | Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); | 353 | Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); |
354 | Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); | 354 | Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); |
355 | 355 | ||
356 | 356 | ||
357 | // кабинет - редактор страниц | 357 | // кабинет - редактор страниц |
358 | Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); | 358 | Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); |
359 | // кабинет - добавление страницы | 359 | // кабинет - добавление страницы |
360 | Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); | 360 | Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); |
361 | // кабинет - сохранение формы страницы | 361 | // кабинет - сохранение формы страницы |
362 | Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); | 362 | Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); |
363 | // кабинет - редактирование форма страницы | 363 | // кабинет - редактирование форма страницы |
364 | Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); | 364 | Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); |
365 | // кабинет - сохранение редактированной формы страницы | 365 | // кабинет - сохранение редактированной формы страницы |
366 | Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); | 366 | Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); |
367 | // кабинет - удаление страницы | 367 | // кабинет - удаление страницы |
368 | Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); | 368 | Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); |
369 | 369 | ||
370 | 370 | ||
371 | // кабинет - реклама сайта | 371 | // кабинет - реклама сайта |
372 | Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); | 372 | Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); |
373 | Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); | 373 | Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); |
374 | Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); | 374 | Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); |
375 | Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); | 375 | Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); |
376 | Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); | 376 | Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); |
377 | Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); | 377 | Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); |
378 | //////////////////////////////////////////////////////////////////////// | 378 | //////////////////////////////////////////////////////////////////////// |
379 | 379 | ||
380 | 380 | ||
381 | // кабинет - отзывы о работодателе для модерации | 381 | // кабинет - отзывы о работодателе для модерации |
382 | Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); | 382 | Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); |
383 | 383 | ||
384 | // Общая страница статистики | 384 | // Общая страница статистики |
385 | Route::get('statics', function () { | 385 | Route::get('statics', function () { |
386 | return view('admin.static.index'); | 386 | return view('admin.static.index'); |
387 | })->name('statics'); | 387 | })->name('statics'); |
388 | 388 | ||
389 | // кабинет - статистика работников | 389 | // кабинет - статистика работников |
390 | Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); | 390 | Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); |
391 | 391 | ||
392 | // кабинет - статистика вакансий работодателя | 392 | // кабинет - статистика вакансий работодателя |
393 | Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); | 393 | Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); |
394 | 394 | ||
395 | // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника | 395 | // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника |
396 | /* | 396 | /* |
397 | * CRUD-операции над справочником дипломы и документы | 397 | * CRUD-операции над справочником дипломы и документы |
398 | */ | 398 | */ |
399 | //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); | 399 | //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); |
400 | Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); | 400 | Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); |
401 | 401 | ||
402 | // кабинет - роли пользователя | 402 | // кабинет - роли пользователя |
403 | Route::get('roles', [UsersController::class, 'roles'])->name('roles'); | 403 | Route::get('roles', [UsersController::class, 'roles'])->name('roles'); |
404 | 404 | ||
405 | Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles'); | 405 | Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles'); |
406 | 406 | ||
407 | Route::get('logs', function() { | 407 | Route::get('logs', function() { |
408 | $files = Storage::files('logs/laravel.log'); | 408 | $files = Storage::files('logs/laravel.log'); |
409 | })->name('logs'); | 409 | })->name('logs'); |
410 | 410 | ||
411 | Route::prefix('faq')->as('faq.')->group(function () { | 411 | Route::prefix('faq')->as('faq.')->group(function () { |
412 | Route::middleware('admin')->group(function () { | 412 | Route::middleware('admin')->group(function () { |
413 | Route::get('/', [FaqController::class, 'showListForAdmin'])->name('list'); | 413 | Route::get('/', [FaqController::class, 'showListForAdmin'])->name('list'); |
414 | Route::get('/create', [FaqController::class, 'create'])->name('create'); | 414 | Route::get('/create', [FaqController::class, 'create'])->name('create'); |
415 | Route::post('/create', [FaqController::class, 'store'])->name('store'); | 415 | Route::post('/create', [FaqController::class, 'store'])->name('store'); |
416 | Route::get('/edit/{id}', [FaqController::class, 'edit'])->name('edit'); | 416 | Route::get('/edit/{id}', [FaqController::class, 'edit'])->name('edit'); |
417 | Route::put('/edit/{id}', [FaqController::class, 'update'])->name('update'); | 417 | Route::put('/edit/{id}', [FaqController::class, 'update'])->name('update'); |
418 | Route::get('/destroy/{id}', [FaqController::class, 'destroy'])->name('destroy'); | 418 | Route::get('/destroy/{id}', [FaqController::class, 'destroy'])->name('destroy'); |
419 | }); | 419 | }); |
420 | }); | 420 | }); |
421 | }); | 421 | }); |
422 | 422 | ||
423 | // Инструментальные страницы | 423 | // Инструментальные страницы |
424 | Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); | 424 | Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); |
425 | 425 | ||
426 | Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); | 426 | Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); |
427 | 427 | ||
428 | Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); | 428 | Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); |
429 | 429 | ||
430 | // Страницы с произвольным контентом | 430 | // Страницы с произвольным контентом |
431 | Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); | 431 | Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); |
432 | 432 | ||
433 | // Форма обратной связи | 433 | // Форма обратной связи |
434 | Route::post('form_feedback', [PagesController::class, 'form_feedback'])->name('form_feedback'); | 434 | Route::post('form_feedback', [PagesController::class, 'form_feedback'])->name('form_feedback'); |
435 | 435 | ||
436 | // Публичные страницы соискателя | 436 | // Публичные страницы соискателя |
437 | Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); | 437 | Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); |
438 | 438 | ||
439 | //Страница вакансии | 439 | //Страница вакансии |
440 | Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer'); | 440 | Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer'); |
441 | 441 | ||
442 | //Вакансии | 442 | //Вакансии |
443 | Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies'); | 443 | Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies'); |
444 | 444 | ||
445 | //Вакансии поиск на главной | 445 | //Вакансии поиск на главной |
446 | Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies'); | 446 | Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies'); |
447 | 447 | ||
448 | //Вакансии категория детальная | 448 | //Вакансии категория детальная |
449 | Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); | 449 | Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); |
450 | 450 | ||
451 | // Лайк вакансии | 451 | // Лайк вакансии |
452 | Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy'); | 452 | Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy'); |
453 | 453 | ||
454 | //Детальная страница вакансии - работодателя | 454 | //Детальная страница вакансии - работодателя |
455 | Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); | 455 | Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); |
456 | 456 | ||
457 | Route::get('vacancy/{vacancy}', [AdEmployerController::class, 'getById'])->name('get-vacancy-by-id'); | 457 | Route::get('vacancy/{vacancy}', [AdEmployerController::class, 'getById'])->name('get-vacancy-by-id'); |
458 | 458 | ||
459 | //Судоходные компании | 459 | //Судоходные компании |
460 | Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies'); | 460 | Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies'); |
461 | 461 | ||
462 | //Детальная инфа о компании | 462 | //Детальная инфа о компании |
463 | Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company'); | 463 | Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company'); |
464 | 464 | ||
465 | //Образование | 465 | //Образование |
466 | Route::get('education', [EducationFrontController::class, 'index'])->name('education'); | 466 | Route::get('education', [EducationFrontController::class, 'index'])->name('education'); |
467 | Route::get('education/{education}', [EducationFrontController::class, 'show'])->name('show_education')->where('education', '[0-9]+');; | 467 | Route::get('education/{education}', [EducationFrontController::class, 'show'])->name('show_education')->where('education', '[0-9]+');; |
468 | 468 | ||
469 | //Новости | 469 | //Новости |
470 | Route::get('news', [MainController::class, 'news'])->name('news'); | 470 | Route::get('news', [MainController::class, 'news'])->name('news'); |
471 | Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new'); | 471 | Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new'); |
472 | 472 | ||
473 | //Контакты | 473 | //Контакты |
474 | Route::get('contacts', [MainController::class, 'contacts'])->name('contacts'); | 474 | Route::get('contacts', [MainController::class, 'contacts'])->name('contacts'); |
475 | 475 | ||
476 | //База резюме | 476 | //База резюме |
477 | Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume'); | 477 | Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume'); |
478 | Route::get('bd_resume_danger', function(){ | 478 | Route::get('bd_resume_danger', function(){ |
479 | return view('employers.bd_resume_danger'); | 479 | return view('employers.bd_resume_danger'); |
480 | })->name('bd_resume_danger'); | 480 | })->name('bd_resume_danger'); |
481 | 481 | ||
482 | Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume'); | 482 | Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume'); |
483 | 483 | ||
484 | //Анкета соискателя | 484 | //Анкета соискателя |
485 | Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile'); | 485 | Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile'); |
486 | 486 | ||
487 | //Скачать резюме | 487 | //Скачать резюме |
488 | Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download'); | 488 | Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download'); |
489 | Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2'); | 489 | Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2'); |
490 | Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all'); | 490 | Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all'); |
491 | 491 | ||
492 | 492 | ||
493 | //Вход в кабинет | 493 | //Вход в кабинет |
494 | Route::get('login', [MainController::class, 'input_login'])->name('login'); | 494 | Route::get('login', [MainController::class, 'input_login'])->name('login'); |
495 | 495 | ||
496 | // Выход из кабинета | 496 | // Выход из кабинета |
497 | Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); | 497 | Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); |
498 | 498 | ||
499 | Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); | 499 | Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); |
500 | Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); | 500 | Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); |
501 | 501 | ||
502 | //восстановление пароля | 502 | //восстановление пароля |
503 | Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); | 503 | Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); |
504 | // Звезда сообщения | 504 | // Звезда сообщения |
505 | Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer'); | 505 | Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer'); |
506 | 506 | ||
507 | // Борьба | 507 | // Борьба |
508 | Route::get('clear_cookie', function() { | 508 | Route::get('clear_cookie', function() { |
509 | \App\Classes\Cookies_vacancy::clear_vacancy(); | 509 | \App\Classes\Cookies_vacancy::clear_vacancy(); |
510 | return redirect()->route('index'); | 510 | return redirect()->route('index'); |
511 | })->name('clear_cookie'); | 511 | })->name('clear_cookie'); |
512 | 512 | ||
513 | Route::get('cookies', function() { | 513 | Route::get('cookies', function() { |
514 | return view('cookies'); | 514 | return view('cookies'); |
515 | })->name('cookies'); | 515 | })->name('cookies'); |
516 | 516 | ||
517 | // Личный кабинет работник | 517 | // Личный кабинет работник |
518 | Route::group([ | 518 | Route::group([ |
519 | 'as' => 'worker.', // имя маршрута, например auth.index | 519 | 'as' => 'worker.', // имя маршрута, например auth.index |
520 | 'prefix' => 'worker', // префикс маршрута, например auth/index | 520 | 'prefix' => 'worker', // префикс маршрута, например auth/index |
521 | 'middleware' => ['auth', 'is_worker'], | 521 | 'middleware' => ['auth', 'is_worker'], |
522 | ], function() { | 522 | ], function() { |
523 | // Формы редактирования | 523 | // Формы редактирования |
524 | Route::get('cabinet/basic_information', [WorkerController::class, 'basic_information'])->name('basic_information'); | 524 | Route::get('cabinet/basic_information', [WorkerController::class, 'basic_information'])->name('basic_information'); |
525 | Route::get('cabinet/additional_documents', [WorkerController::class, 'additional_documents'])->name('additional_documents'); | 525 | Route::get('cabinet/additional_documents', [WorkerController::class, 'additional_documents'])->name('additional_documents'); |
526 | 526 | ||
527 | // 1 страница - Моя анкета | 527 | // 1 страница - Моя анкета |
528 | Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet'); | 528 | Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet'); |
529 | Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save'); | 529 | Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save'); |
530 | Route::post('cabinet/cabinet_save_foto/{worker}', [WorkerController::class, 'cabinet_save_foto'])->name('cabinet_save_foto'); | 530 | Route::post('cabinet/cabinet_save_foto/{worker}', [WorkerController::class, 'cabinet_save_foto'])->name('cabinet_save_foto'); |
531 | 531 | ||
532 | 532 | ||
533 | // 2 страница - Сообщения | 533 | // 2 страница - Сообщения |
534 | Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages'); | 534 | Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages'); |
535 | Route::get('cabinet/dialog/{chat}', [WorkerController::class, 'dialog'])->name('dialog'); | 535 | Route::get('cabinet/dialog/{chat}', [WorkerController::class, 'dialog'])->name('dialog'); |
536 | // 3 страница - Избранные вакансии | 536 | // 3 страница - Избранные вакансии |
537 | Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite'); | 537 | Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite'); |
538 | // Продолжение борьбы против колорадов - избранные вакансии | 538 | // Продолжение борьбы против колорадов - избранные вакансии |
539 | Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado'); | 539 | Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado'); |
540 | 540 | ||
541 | // 4 страница - Сменить пароль | 541 | // 4 страница - Сменить пароль |
542 | Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password'); | 542 | Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password'); |
543 | Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password'); | 543 | Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password'); |
544 | 544 | ||
545 | // 5 страница - Удалить профиль | 545 | // 5 страница - Удалить профиль |
546 | Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile'); | 546 | Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile'); |
547 | Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result'); | 547 | Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result'); |
548 | 548 | ||
549 | // Резюме -pdf | 549 | // Резюме -pdf |
550 | Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download'); | 550 | Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download'); |
551 | 551 | ||
552 | // Поднятие анкеты | 552 | // Поднятие анкеты |
553 | Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up'); | 553 | Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up'); |
554 | 554 | ||
555 | Route::post('test123', [WorkerController::class, 'test123'])->name('test123'); | 555 | Route::post('test123', [WorkerController::class, 'test123'])->name('test123'); |
556 | 556 | ||
557 | // Добавление сертификата | 557 | // Добавление сертификата |
558 | Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate'); | 558 | Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate'); |
559 | Route::post('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate'); | 559 | Route::post('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate'); |
560 | Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate'); | 560 | Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate'); |
561 | Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate'); | 561 | Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate'); |
562 | Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate'); | 562 | Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate'); |
563 | 563 | ||
564 | // Добавление предыдущих контактов компании | 564 | // Добавление предыдущих контактов компании |
565 | Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company'); | 565 | Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company'); |
566 | Route::post('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company'); | 566 | Route::post('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company'); |
567 | Route::get('кабинет/edit_prev_company/{doc}/{worker}', [WorkerController::class, 'edit_prev_company'])->name('edit_prev_company'); | 567 | Route::get('кабинет/edit_prev_company/{doc}/{worker}', [WorkerController::class, 'edit_prev_company'])->name('edit_prev_company'); |
568 | Route::post('кабинет/update_prev_company/{doc}', [WorkerController::class, 'update_prev_company'])->name('update_prev_company'); | 568 | Route::post('кабинет/update_prev_company/{doc}', [WorkerController::class, 'update_prev_company'])->name('update_prev_company'); |
569 | Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company'); | 569 | Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company'); |
570 | 570 | ||
571 | // Добавление документа-диплома | 571 | // Добавление документа-диплома |
572 | Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom'); | 572 | Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom'); |
573 | Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save'); | 573 | Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save'); |
574 | Route::put('кабинет/edit_diploms/{worker}', [WorkerController::class, 'edit_diploms'])->name('edit_diploms'); | 574 | Route::put('кабинет/edit_diploms/{worker}', [WorkerController::class, 'edit_diploms'])->name('edit_diploms'); |
575 | Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom'); | 575 | Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom'); |
576 | 576 | ||
577 | // Добавление стандартного диплома | 577 | // Добавление стандартного диплома |
578 | Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document'); | 578 | Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document'); |
579 | Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save'); | 579 | Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save'); |
580 | Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document'); | 580 | Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document'); |
581 | Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save'); | 581 | Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save'); |
582 | Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document'); | 582 | Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document'); |
583 | 583 | ||
584 | // Отправка сообщения работодателю от соискателя | 584 | // Отправка сообщения работодателю от соискателя |
585 | Route::post('сообщение/', [WorkerController::class, 'new_message'])->name('new_message'); | 585 | Route::post('сообщение/', [WorkerController::class, 'new_message']) |
586 | ->withoutMiddleware('is_worker') | ||
587 | ->name('new_message'); | ||
586 | }); | 588 | }); |
587 | 589 | ||
588 | // Личный кабинет работодателя | 590 | // Личный кабинет работодателя |
589 | Route::group([ | 591 | Route::group([ |
590 | 'as' => 'employer.', // имя маршрута, например auth.index | 592 | 'as' => 'employer.', // имя маршрута, например auth.index |
591 | 'prefix' => 'employer', // префикс маршрута, например auth/index | 593 | 'prefix' => 'employer', // префикс маршрута, например auth/index |
592 | 'middleware' => ['auth', 'is_employer'], | 594 | 'middleware' => ['auth', 'is_employer'], |
593 | ], function() { | 595 | ], function() { |
594 | // 0 страница - Личные данные работодателя | 596 | // 0 страница - Личные данные работодателя |
595 | Route::get('cabinet/employer_info', [EmployerController::class, 'employer_info'])->name('employer_info'); | 597 | Route::get('cabinet/employer_info', [EmployerController::class, 'employer_info'])->name('employer_info'); |
596 | Route::post('cabinet/employer_info/{user}', [EmployerController::class, 'employer_info_save'])->name('employer_info_save'); | 598 | Route::post('cabinet/employer_info/{user}', [EmployerController::class, 'employer_info_save'])->name('employer_info_save'); |
597 | 599 | ||
598 | // 1 страница - Профиль | 600 | // 1 страница - Профиль |
599 | Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet'); | 601 | Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet'); |
600 | Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save'); | 602 | Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save'); |
601 | Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot'); | 603 | Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot'); |
602 | Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot'); | 604 | Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot'); |
603 | Route::get('cabinet/flot_edit/{Flot}/{Employer}', [EmployerController::class, 'edit_flot'])->name('edit_flot'); | 605 | Route::get('cabinet/flot_edit/{Flot}/{Employer}', [EmployerController::class, 'edit_flot'])->name('edit_flot'); |
604 | Route::post('cabinet/flot_edit/{Flot}', [EmployerController::class, 'update_flot'])->name('update_flot_save'); | 606 | Route::post('cabinet/flot_edit/{Flot}', [EmployerController::class, 'update_flot'])->name('update_flot_save'); |
605 | Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot'); | 607 | Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot'); |
606 | 608 | ||
607 | Route::get('social/{social}/{vacancy}', [Ad_jobsController::class, 'sendVacancyToSocial']) | 609 | Route::get('social/{social}/{vacancy}', [Ad_jobsController::class, 'sendVacancyToSocial']) |
608 | ->name('send-vacancy-to-social'); | 610 | ->name('send-vacancy-to-social'); |
609 | 611 | ||
610 | // 2 страница - Добавление вакансий | 612 | // 2 страница - Добавление вакансий |
611 | Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie'); | 613 | Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie'); |
612 | Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save'); | 614 | Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save'); |
613 | //Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); | 615 | //Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); |
614 | 616 | ||
615 | Route::get('cabinet/vacancie_danger', [EmployerController::class, 'cabinet_vacancie_danger'])->name('cabinet_vacancie_danger'); | 617 | Route::get('cabinet/vacancie_danger', [EmployerController::class, 'cabinet_vacancie_danger'])->name('cabinet_vacancie_danger'); |
616 | 618 | ||
617 | 619 | ||
618 | 620 | ||
619 | Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); | 621 | Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); |
620 | 622 | ||
621 | // 3 страница - Мои вакансии | 623 | // 3 страница - Мои вакансии |
622 | Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list'); | 624 | Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list'); |
623 | Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); | 625 | Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); |
624 | Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete'); | 626 | Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete'); |
625 | Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up'); | 627 | Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up'); |
626 | Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye'); | 628 | Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye'); |
627 | Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); | 629 | Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); |
628 | Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); | 630 | Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); |
629 | 631 | ||
630 | // 4.1Ю. | 632 | // 4.1Ю. |
631 | Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac'); | 633 | Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac'); |
632 | Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save'); | 634 | Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save'); |
633 | Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac'); | 635 | Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac'); |
634 | Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save'); | 636 | Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save'); |
635 | Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac'); | 637 | Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac'); |
636 | 638 | ||
637 | // 4 страница - Отклики на вакансии | 639 | // 4 страница - Отклики на вакансии |
638 | Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers'); | 640 | Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers'); |
639 | Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple'); | 641 | Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple'); |
640 | Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg'); | 642 | Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg'); |
641 | 643 | ||
642 | // 5 страница - Сообщения | 644 | // 5 страница - Сообщения |
643 | Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages'); | 645 | Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages'); |
644 | Route::get('cabinet/dialog/{chat}', [EmployerController::class, 'dialog'])->name('dialog'); | 646 | Route::get('cabinet/dialog/{chat}', [EmployerController::class, 'dialog'])->name('dialog'); |
645 | Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message'); | 647 | Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message'); |
646 | Route::post('test123', [EmployerController::class, 'test123'])->name('test123'); | 648 | Route::post('test123', [EmployerController::class, 'test123'])->name('test123'); |
647 | 649 | ||
648 | // 6 страница - Избранный | 650 | // 6 страница - Избранный |
649 | Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites'); | 651 | Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites'); |
650 | 652 | ||
651 | //7 страница - База данных | 653 | //7 страница - База данных |
652 | Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd'); | 654 | Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd'); |
653 | 655 | ||
654 | //8 страница - База резюме | 656 | //8 страница - База резюме |
655 | Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe'); | 657 | Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe'); |
656 | 658 | ||
657 | // 9 рассылка сообщений | 659 | // 9 рассылка сообщений |
658 | Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages'); | 660 | Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages'); |
659 | Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post'); | 661 | Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post'); |
660 | 662 | ||
661 | // 10 страница FAQ вопрос | 663 | // 10 страница FAQ вопрос |
662 | Route::get('cabinet/faq', [FaqController::class, 'showListForUser'])->name('faq'); | 664 | Route::get('cabinet/faq', [FaqController::class, 'showListForUser'])->name('faq'); |
663 | 665 | ||
664 | // 11 страница - Настройка уведомлений | 666 | // 11 страница - Настройка уведомлений |
665 | Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe'); | 667 | Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe'); |
666 | Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe'); | 668 | Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe'); |
667 | 669 | ||
668 | // 12 страница - Сменить пароль | 670 | // 12 страница - Сменить пароль |
669 | Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset'); | 671 | Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset'); |
670 | Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password'); | 672 | Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password'); |
671 | 673 | ||
672 | // 13 страница - Удаление профиля | 674 | // 13 страница - Удаление профиля |
673 | Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people'); | 675 | Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people'); |
674 | Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user'); | 676 | Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user'); |
675 | Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user'); | 677 | Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user'); |
676 | 678 | ||
677 | // Отправил сообщение | 679 | // Отправил сообщение |
678 | Route::post('сообщение/', [EmployerController::class, 'new_message']) | 680 | Route::post('сообщение/', [EmployerController::class, 'new_message']) |
679 | ->withoutMiddleware('is_employer') | 681 | ->withoutMiddleware('is_employer') |
680 | ->name('new_message'); | 682 | ->name('new_message'); |
681 | 683 | ||
682 | Route::post('pin_chat/', [EmployerController::class, 'pin_chat'])->name('pin_chat'); | 684 | Route::post('pin_chat/', [EmployerController::class, 'pin_chat'])->name('pin_chat'); |
683 | Route::post('remove_chat/', [EmployerController::class, 'remove_chat'])->name('remove_chat'); | 685 | Route::post('remove_chat/', [EmployerController::class, 'remove_chat'])->name('remove_chat'); |
684 | }); | 686 | }); |
685 | 687 | ||
686 | Route::get('TestWorker', [WorkerController::class, 'TestWorker'])->name('TestWorker'); | 688 | Route::get('TestWorker', [WorkerController::class, 'TestWorker'])->name('TestWorker'); |
687 | 689 | ||
688 | Route::post('send_message', [HomeController::class, 'send_message'])->name('send_message'); | 690 | Route::post('send_message', [HomeController::class, 'send_message'])->name('send_message'); |
689 | 691 | ||
690 | 692 |