Commit 6e22552141ffa77e3595cad46f3d68b060130c51
1 parent
f8a3cafe55
Exists in
master
and in
1 other branch
Работа над сообщениями и диалогами
Showing 13 changed files with 343 additions and 49 deletions Inline Diff
- app/Http/Controllers/EmployerController.php
- app/Http/Controllers/MainController.php
- app/Http/Controllers/WorkerController.php
- app/Http/Requests/BaseUser_min_Request.php
- app/Models/Message.php
- database/migrations/2024_04_17_060549_alter_table_messages.php
- resources/views/employers/cabinet45.blade.php
- resources/views/employers/dialog.blade.php
- resources/views/employers/info.blade.php
- resources/views/employers/menu.blade.php
- resources/views/employers/messages.blade.php
- resources/views/workers/messages.blade.php
- routes/web.php
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; | ||
8 | use App\Http\Requests\BaseUserRequest; | ||
7 | use App\Http\Requests\FlotRequest; | 9 | use App\Http\Requests\FlotRequest; |
8 | use App\Http\Requests\MessagesRequiest; | 10 | use App\Http\Requests\MessagesRequiest; |
9 | use App\Http\Requests\VacancyRequestEdit; | 11 | use App\Http\Requests\VacancyRequestEdit; |
10 | use App\Http\Requests\VacansiaRequiest; | 12 | use App\Http\Requests\VacansiaRequiest; |
11 | use App\Mail\MailSotrudnichestvo; | 13 | use App\Mail\MailSotrudnichestvo; |
12 | use App\Mail\SendAllMessages; | 14 | use App\Mail\SendAllMessages; |
13 | use App\Models\Ad_employer; | 15 | use App\Models\Ad_employer; |
14 | use App\Models\Ad_jobs; | 16 | use App\Models\Ad_jobs; |
15 | use App\Models\ad_response; | 17 | use App\Models\ad_response; |
16 | use App\Models\Category; | 18 | use App\Models\Category; |
17 | use App\Models\Education; | 19 | use App\Models\Education; |
18 | use App\Models\Employer; | 20 | use App\Models\Employer; |
19 | use App\Models\employers_main; | 21 | use App\Models\employers_main; |
20 | use App\Models\Flot; | 22 | use App\Models\Flot; |
21 | use App\Models\Job_title; | 23 | use App\Models\Job_title; |
22 | use App\Models\Like_vacancy; | 24 | use App\Models\Like_vacancy; |
23 | use App\Models\Like_worker; | 25 | use App\Models\Like_worker; |
24 | use App\Models\Message; | 26 | use App\Models\Message; |
25 | use App\Models\Positions; | 27 | use App\Models\Positions; |
26 | use App\Models\Worker; | 28 | use App\Models\Worker; |
27 | use Carbon\Carbon; | 29 | use Carbon\Carbon; |
28 | use Illuminate\Auth\Events\Registered; | 30 | use Illuminate\Auth\Events\Registered; |
29 | use Illuminate\Database\Eloquent\Builder; | 31 | use Illuminate\Database\Eloquent\Builder; |
30 | use Illuminate\Database\Eloquent\Model; | 32 | use Illuminate\Database\Eloquent\Model; |
31 | use Illuminate\Foundation\Auth\User; | 33 | use Illuminate\Foundation\Auth\User; |
32 | use Illuminate\Http\Request; | 34 | use Illuminate\Http\Request; |
33 | use Illuminate\Support\Facades\Auth; | 35 | use Illuminate\Support\Facades\Auth; |
34 | use Illuminate\Support\Facades\Hash; | 36 | use Illuminate\Support\Facades\Hash; |
35 | use Illuminate\Support\Facades\Mail; | 37 | use Illuminate\Support\Facades\Mail; |
36 | use Illuminate\Support\Facades\Storage; | 38 | use Illuminate\Support\Facades\Storage; |
37 | use App\Models\User as User_Model; | 39 | use App\Models\User as User_Model; |
38 | use Illuminate\Support\Facades\Validator; | 40 | use Illuminate\Support\Facades\Validator; |
39 | 41 | ||
40 | class EmployerController extends Controller | 42 | class EmployerController extends Controller |
41 | { | 43 | { |
42 | public function vacancie($vacancy, Request $request) { | 44 | public function vacancie($vacancy, Request $request) { |
43 | $title = 'Заголовок вакансии'; | 45 | $title = 'Заголовок вакансии'; |
44 | $Query = Ad_employer::with('jobs')-> | 46 | $Query = Ad_employer::with('jobs')-> |
45 | with('cat')-> | 47 | with('cat')-> |
46 | with('employer')-> | 48 | with('employer')-> |
47 | with('jobs_code')-> | 49 | with('jobs_code')-> |
48 | select('ad_employers.*')-> | 50 | select('ad_employers.*')-> |
49 | where('id', '=', $vacancy)->get(); | 51 | where('id', '=', $vacancy)->get(); |
50 | 52 | ||
51 | if (isset(Auth()->user()->id)) | 53 | if (isset(Auth()->user()->id)) |
52 | $uid = Auth()->user()->id; | 54 | $uid = Auth()->user()->id; |
53 | else | 55 | else |
54 | $uid = 0; | 56 | $uid = 0; |
55 | $title = $Query[0]->name; | 57 | $title = $Query[0]->name; |
56 | if ($request->ajax()) { | 58 | if ($request->ajax()) { |
57 | return view('ajax.vacance-item', compact('Query','uid')); | 59 | return view('ajax.vacance-item', compact('Query','uid')); |
58 | } else { | 60 | } else { |
59 | return view('vacance-item', compact('title', 'Query', 'uid')); | 61 | return view('vacance-item', compact('title', 'Query', 'uid')); |
60 | } | 62 | } |
61 | } | 63 | } |
62 | 64 | ||
63 | public function logout() { | 65 | public function logout() { |
64 | Auth::logout(); | 66 | Auth::logout(); |
65 | return redirect()->route('index') | 67 | return redirect()->route('index') |
66 | ->with('success', 'Вы вышли из личного кабинета'); | 68 | ->with('success', 'Вы вышли из личного кабинета'); |
67 | } | 69 | } |
68 | 70 | ||
71 | public function employer_info() { | ||
72 | // код юзера | ||
73 | $user_info = Auth()->user(); | ||
74 | // вьюшка для вывода данных | ||
75 | return view('employers.info', compact('user_info')); | ||
76 | } | ||
77 | |||
78 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { | ||
79 | // Все данные через реквест | ||
80 | $all = $request->all(); | ||
81 | unset($all['_token']); | ||
82 | // обновление | ||
83 | $user->update($all); | ||
84 | return redirect()->route('employer.employer_info'); | ||
85 | } | ||
86 | |||
69 | public function cabinet() { | 87 | public function cabinet() { |
70 | $id = Auth()->user()->id; | 88 | $id = Auth()->user()->id; |
71 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 89 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
72 | WhereHas('users', | 90 | WhereHas('users', |
73 | function (Builder $query) use ($id) {$query->Where('id', $id); | 91 | function (Builder $query) use ($id) {$query->Where('id', $id); |
74 | })->get(); | 92 | })->get(); |
75 | return view('employers.cabinet45', compact('Employer')); | 93 | return view('employers.cabinet45', compact('Employer')); |
76 | } | 94 | } |
77 | 95 | ||
78 | public function slider_flot() { | 96 | public function slider_flot() { |
79 | $id = Auth()->user()->id; | 97 | $id = Auth()->user()->id; |
80 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
81 | WhereHas('users', | 99 | WhereHas('users', |
82 | function (Builder $query) use ($id) {$query->Where('id', $id); | 100 | function (Builder $query) use ($id) {$query->Where('id', $id); |
83 | })->get(); | 101 | })->get(); |
84 | return view('employers.fly-flot', compact('Employer')); | 102 | return view('employers.fly-flot', compact('Employer')); |
85 | } | 103 | } |
86 | 104 | ||
87 | public function cabinet_save(Employer $Employer, Request $request) { | 105 | public function cabinet_save(Employer $Employer, Request $request) { |
88 | $params = $request->all(); | 106 | $params = $request->all(); |
89 | $params['user_id'] = Auth()->user()->id; | 107 | $params['user_id'] = Auth()->user()->id; |
90 | $id = $Employer->id; | 108 | $id = $Employer->id; |
91 | 109 | ||
92 | if ($request->has('logo')) { | 110 | if ($request->has('logo')) { |
93 | if (!empty($Employer->logo)) { | 111 | if (!empty($Employer->logo)) { |
94 | Storage::delete($Employer->logo); | 112 | Storage::delete($Employer->logo); |
95 | } | 113 | } |
96 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); | 114 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); |
97 | } | 115 | } |
98 | 116 | ||
99 | $Employer->update($params); | 117 | $Employer->update($params); |
100 | 118 | ||
101 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); | 119 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); |
102 | } | 120 | } |
103 | 121 | ||
104 | public function save_add_flot(FlotRequest $request) { | 122 | public function save_add_flot(FlotRequest $request) { |
105 | // отмена | 123 | // отмена |
106 | $params = $request->all(); | 124 | $params = $request->all(); |
107 | 125 | ||
108 | if ($request->has('image')) { | 126 | if ($request->has('image')) { |
109 | $params['image'] = $request->file('image')->store("flot", 'public'); | 127 | $params['image'] = $request->file('image')->store("flot", 'public'); |
110 | } | 128 | } |
111 | Flot::create($params); | 129 | Flot::create($params); |
112 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); | 130 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); |
113 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 131 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
114 | } | 132 | } |
115 | 133 | ||
116 | public function delete_flot(Flot $Flot) { | 134 | public function delete_flot(Flot $Flot) { |
117 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); | 135 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); |
118 | 136 | ||
119 | if (isset($Flot->id)) $Flot->delete(); | 137 | if (isset($Flot->id)) $Flot->delete(); |
120 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); | 138 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); |
121 | } | 139 | } |
122 | 140 | ||
123 | // Форма добавления вакансий | 141 | // Форма добавления вакансий |
124 | public function cabinet_vacancie() { | 142 | public function cabinet_vacancie() { |
125 | $id = Auth()->user()->id; | 143 | $id = Auth()->user()->id; |
126 | 144 | ||
127 | $categories = Category::query()->active()->get(); | 145 | $categories = Category::query()->active()->get(); |
128 | $Positions = Category::query()->active()->get(); | 146 | $Positions = Category::query()->active()->get(); |
129 | if ($Positions->count()) { | 147 | if ($Positions->count()) { |
130 | $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', $Positions[0]->id)->get(); | 148 | $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', $Positions[0]->id)->get(); |
131 | } else { | 149 | } else { |
132 | $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', 0)->get(); | 150 | $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', 0)->get(); |
133 | } | 151 | } |
134 | 152 | ||
135 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 153 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
136 | WhereHas('users', | 154 | WhereHas('users', |
137 | function (Builder $query) use ($id) {$query->Where('id', $id); | 155 | function (Builder $query) use ($id) {$query->Where('id', $id); |
138 | })->get(); | 156 | })->get(); |
139 | 157 | ||
140 | return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories', 'Positions')); | 158 | return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories', 'Positions')); |
141 | } | 159 | } |
142 | 160 | ||
143 | // Сохранение вакансии | 161 | // Сохранение вакансии |
144 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { | 162 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { |
145 | $params_emp = $request->all(); | 163 | $params_emp = $request->all(); |
146 | $params_job["job_title_id"] = $params_emp['job_title_id']; | 164 | $params_job["job_title_id"] = $params_emp['job_title_id']; |
147 | $params_job["min_salary"] = $params_emp['min_salary']; | 165 | $params_job["min_salary"] = $params_emp['min_salary']; |
148 | $params_job["max_salary"] = $params_emp['max_salary']; | 166 | $params_job["max_salary"] = $params_emp['max_salary']; |
149 | $params_job["region"] = $params_emp['region']; | 167 | $params_job["region"] = $params_emp['region']; |
150 | $params_job["power"] = $params_emp['power']; | 168 | $params_job["power"] = $params_emp['power']; |
151 | $params_job["sytki"] = $params_emp['sytki']; | 169 | $params_job["sytki"] = $params_emp['sytki']; |
152 | $params_job["start"] = $params_emp['start']; | 170 | $params_job["start"] = $params_emp['start']; |
153 | $params_job["flot"] = $params_emp['flot']; | 171 | $params_job["flot"] = $params_emp['flot']; |
154 | $params_job["description"] = $params_emp['description']; | 172 | $params_job["description"] = $params_emp['description']; |
155 | 173 | ||
156 | $ad_jobs = Ad_employer::create($params_emp); | 174 | $ad_jobs = Ad_employer::create($params_emp); |
157 | $params_job['ad_employer_id'] = $ad_jobs->id; | 175 | $params_job['ad_employer_id'] = $ad_jobs->id; |
158 | Ad_jobs::create($params_job); | 176 | Ad_jobs::create($params_job); |
159 | return redirect()->route('employer.vacancy_list'); | 177 | return redirect()->route('employer.vacancy_list'); |
160 | } | 178 | } |
161 | 179 | ||
162 | // Список вакансий | 180 | // Список вакансий |
163 | public function vacancy_list(Request $request) { | 181 | public function vacancy_list(Request $request) { |
164 | $id = Auth()->user()->id; | 182 | $id = Auth()->user()->id; |
165 | $Employer = Employer::query()->where('user_id', $id)->first(); | 183 | $Employer = Employer::query()->where('user_id', $id)->first(); |
166 | $vacancy_list = Ad_employer::query()->with('jobs')-> | 184 | $vacancy_list = Ad_employer::query()->with('jobs')-> |
167 | with('jobs_code')-> | 185 | with('jobs_code')-> |
168 | where('employer_id', $Employer->id); | 186 | where('employer_id', $Employer->id); |
169 | 187 | ||
170 | if ($request->get('sort')) { | 188 | if ($request->get('sort')) { |
171 | $sort = $request->get('sort'); | 189 | $sort = $request->get('sort'); |
172 | switch ($sort) { | 190 | switch ($sort) { |
173 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; | 191 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; |
174 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; | 192 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; |
175 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; | 193 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; |
176 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; | 194 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; |
177 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 195 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
178 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 196 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
179 | } | 197 | } |
180 | } | 198 | } |
181 | $vacancy_list = $vacancy_list->paginate(4); | 199 | $vacancy_list = $vacancy_list->paginate(4); |
182 | 200 | ||
183 | //ajax | 201 | //ajax |
184 | if ($request->ajax()) { | 202 | if ($request->ajax()) { |
185 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); | 203 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); |
186 | } else { | 204 | } else { |
187 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); | 205 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); |
188 | } | 206 | } |
189 | } | 207 | } |
190 | 208 | ||
191 | // Карточка вакансии | 209 | // Карточка вакансии |
192 | public function vacancy_edit(Ad_employer $ad_employer) { | 210 | public function vacancy_edit(Ad_employer $ad_employer) { |
193 | $id = Auth()->user()->id; | 211 | $id = Auth()->user()->id; |
194 | 212 | ||
195 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 213 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
196 | if ($Positions->count()) { | 214 | if ($Positions->count()) { |
197 | $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); | 215 | $jobs = Job_title::query()->OrderBy('name')->where('position_id', $Positions[0]->id)->get(); |
198 | } else { | 216 | } else { |
199 | $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); | 217 | $jobs = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); |
200 | } | 218 | } |
201 | 219 | ||
202 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 220 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
203 | where('user_id', $id)->first(); | 221 | where('user_id', $id)->first(); |
204 | 222 | ||
205 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 223 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
206 | } | 224 | } |
207 | 225 | ||
208 | // Сохранение-редактирование записи | 226 | // Сохранение-редактирование записи |
209 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { | 227 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { |
210 | $params = $request->all(); | 228 | $params = $request->all(); |
211 | 229 | ||
212 | //$jobs['flot'] = $params['flot']; | 230 | //$jobs['flot'] = $params['flot']; |
213 | //$jobs['job_title_id'] = $params['job_title_id']; | 231 | //$jobs['job_title_id'] = $params['job_title_id']; |
214 | //$titles['position_id'] = $params['position_id']; | 232 | //$titles['position_id'] = $params['position_id']; |
215 | //unset($params['job_title_id']); | 233 | //unset($params['job_title_id']); |
216 | 234 | ||
217 | $ad_employer->update($params); | 235 | $ad_employer->update($params); |
218 | 236 | ||
219 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> | 237 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> |
220 | // where('ad_employer_id', $ad_employer->id)->first(); | 238 | // where('ad_employer_id', $ad_employer->id)->first(); |
221 | //$data = Ad_jobs::find($job_->id); | 239 | //$data = Ad_jobs::find($job_->id); |
222 | //$ad_jobs = $data->update($jobs); | 240 | //$ad_jobs = $data->update($jobs); |
223 | 241 | ||
224 | return redirect()->route('employer.vacancy_list'); | 242 | return redirect()->route('employer.vacancy_list'); |
225 | } | 243 | } |
226 | 244 | ||
227 | // Сохранение карточки вакансии | 245 | // Сохранение карточки вакансии |
228 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { | 246 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { |
229 | $all = $request->all(); | 247 | $all = $request->all(); |
230 | $ad_employer->update($all); | 248 | $ad_employer->update($all); |
231 | return redirect()->route('employer.cabinet_vacancie'); | 249 | return redirect()->route('employer.cabinet_vacancie'); |
232 | } | 250 | } |
233 | 251 | ||
234 | // Удаление карточки вакансии | 252 | // Удаление карточки вакансии |
235 | public function vacancy_delete(Ad_employer $ad_employer) { | 253 | public function vacancy_delete(Ad_employer $ad_employer) { |
236 | $ad_employer->delete(); | 254 | $ad_employer->delete(); |
237 | 255 | ||
238 | return redirect()->route('employer.vacancy_list') | 256 | return redirect()->route('employer.vacancy_list') |
239 | ->with('success', 'Данные были успешно сохранены'); | 257 | ->with('success', 'Данные были успешно сохранены'); |
240 | } | 258 | } |
241 | 259 | ||
242 | // Обновление даты | 260 | // Обновление даты |
243 | public function vacancy_up(Ad_employer $ad_employer) { | 261 | public function vacancy_up(Ad_employer $ad_employer) { |
244 | $up = date('m/d/Y h:i:s', time());; | 262 | $up = date('m/d/Y h:i:s', time());; |
245 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 263 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
246 | $vac_emp->updated_at = $up; | 264 | $vac_emp->updated_at = $up; |
247 | $vac_emp->save(); | 265 | $vac_emp->save(); |
248 | 266 | ||
249 | return redirect()->route('employer.vacancy_list'); | 267 | return redirect()->route('employer.vacancy_list'); |
250 | // начало конца | 268 | // начало конца |
251 | } | 269 | } |
252 | 270 | ||
253 | //Видимость вакансии | 271 | //Видимость вакансии |
254 | public function vacancy_eye(Ad_employer $ad_employer, $status) { | 272 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
255 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 273 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
256 | $vac_emp->active_is = $status; | 274 | $vac_emp->active_is = $status; |
257 | $vac_emp->save(); | 275 | $vac_emp->save(); |
258 | 276 | ||
259 | return redirect()->route('employer.vacancy_list'); | 277 | return redirect()->route('employer.vacancy_list'); |
260 | } | 278 | } |
261 | 279 | ||
262 | //Вакансия редактирования (шаблон) | 280 | //Вакансия редактирования (шаблон) |
263 | public function vacancy_update(Ad_employer $id) { | 281 | public function vacancy_update(Ad_employer $id) { |
264 | 282 | ||
265 | } | 283 | } |
266 | 284 | ||
267 | //Отклики на вакансию - лист | 285 | //Отклики на вакансию - лист |
268 | public function answers(Employer $employer, Request $request) { | 286 | public function answers(Employer $employer, Request $request) { |
269 | $user_id = Auth()->user()->id; | 287 | $user_id = Auth()->user()->id; |
270 | $answer = Ad_employer::query()->where('employer_id', $employer->id); | 288 | $answer = Ad_employer::query()->where('employer_id', $employer->id); |
271 | if ($request->has('search')) { | 289 | if ($request->has('search')) { |
272 | $search = trim($request->get('search')); | 290 | $search = trim($request->get('search')); |
273 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); | 291 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); |
274 | } | 292 | } |
275 | 293 | ||
276 | $answer = $answer->with('response')->get(); | 294 | $answer = $answer->with('response')->get(); |
277 | 295 | ||
278 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); | 296 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); |
279 | } | 297 | } |
280 | 298 | ||
281 | //Обновление статуса | 299 | //Обновление статуса |
282 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { | 300 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { |
283 | $ad_response->update(Array('flag' => $flag)); | 301 | $ad_response->update(Array('flag' => $flag)); |
284 | return redirect()->route('employer.answers', ['employer' => $employer->id]); | 302 | return redirect()->route('employer.answers', ['employer' => $employer->id]); |
285 | } | 303 | } |
286 | 304 | ||
287 | //Страницы сообщений список | 305 | //Страницы сообщений список |
288 | public function messages($type_message) { | 306 | public function messages($type_message) { |
289 | $user_id = Auth()->user()->id; | 307 | $user_id = Auth()->user()->id; |
290 | 308 | ||
291 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 309 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
292 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 310 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
293 | 311 | ||
294 | $messages_output = Message::query()->with('vacancies')-> | 312 | $messages_output = Message::query()->with('vacancies')-> |
295 | with('user_to')->where('user_id', $user_id)-> | 313 | with('user_to')->where('user_id', $user_id)-> |
296 | OrderByDesc('created_at'); | 314 | OrderByDesc('created_at'); |
297 | 315 | ||
298 | 316 | ||
299 | $count_input = $messages_input->count(); | 317 | $count_input = $messages_input->count(); |
300 | $count_output = $messages_output->count(); | 318 | $count_output = $messages_output->count(); |
301 | 319 | ||
302 | if ($type_message == 'input') { | 320 | if ($type_message == 'input') { |
303 | $messages = $messages_input->paginate(15); | 321 | $messages = $messages_input->paginate(5); |
304 | } | 322 | } |
305 | 323 | ||
306 | if ($type_message == 'output') { | 324 | if ($type_message == 'output') { |
307 | $messages = $messages_output->paginate(15); | 325 | $messages = $messages_output->paginate(5); |
308 | } | 326 | } |
309 | 327 | ||
328 | //dd($user_id, $messages[2]->vacancies); | ||
329 | //jobs); | ||
330 | |||
310 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 331 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
311 | } | 332 | } |
312 | 333 | ||
313 | // Диалог между пользователями | 334 | // Диалог между пользователями |
314 | public function dialog(User_Model $user1, User_Model $user2) { | 335 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { |
336 | // Получение параметров. | ||
337 | if ($request->has('ad_employer')){ | ||
338 | $ad_employer = $request->get('ad_employer'); | ||
339 | } else { | ||
340 | $ad_employer = 0; | ||
341 | } | ||
342 | |||
315 | if (isset($user2->id)) { | 343 | if (isset($user2->id)) { |
316 | $companion = User_Model::query()->with('workers')-> | 344 | $companion = User_Model::query()->with('workers')-> |
317 | with('employers')-> | 345 | with('employers')-> |
318 | where('id', $user2->id)->first(); | 346 | where('id', $user2->id)->first(); |
319 | } | 347 | } |
320 | 348 | ||
321 | $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { | 349 | $Messages = Message::query()-> |
350 | where('ad_employer_id', '=', $ad_employer)-> | ||
351 | where(function($query) use ($user1, $user2) { | ||
322 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 352 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
323 | })->orWhere(function($query) use ($user1, $user2) { | 353 | })->orWhere(function($query) use ($user1, $user2) { |
324 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 354 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
325 | })->OrderBy('created_at')->get(); | 355 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); |
326 | 356 | ||
327 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; | 357 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; |
328 | /*foreach ($Messages as $it) { | ||
329 | if (isset($it->response)) { | ||
330 | foreach ($it->response as $r) { | ||
331 | if (isset($r->ad_employer_id)) { | ||
332 | $id_vac = $r->ad_employer_id; | ||
333 | break; | ||
334 | } | ||
335 | } | ||
336 | } | ||
337 | if (!is_null($id_vac)) break; | ||
338 | } | ||
339 | */ | ||
340 | 358 | ||
341 | $ad_employer = null; | 359 | //$ad_employer = null; |
342 | if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 360 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
343 | $sender = $user1; | 361 | $sender = $user1; |
344 | return view('employers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); | 362 | |
363 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); | ||
345 | } | 364 | } |
346 | 365 | ||
347 | // Регистрация работодателя | 366 | // Регистрация работодателя |
348 | public function register_employer(Request $request) { | 367 | public function register_employer(Request $request) { |
349 | $params = $request->all(); | 368 | $params = $request->all(); |
350 | 369 | ||
351 | $rules = [ | 370 | $rules = [ |
352 | //'surname' => ['required', 'string', 'max:255'], | 371 | //'surname' => ['required', 'string', 'max:255'], |
353 | //'name_man' => ['required', 'string', 'max:255'], | 372 | //'name_man' => ['required', 'string', 'max:255'], |
354 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | 373 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
355 | 'name_company' => ['required', 'string', 'max:255'], | 374 | 'name_company' => ['required', 'string', 'max:255'], |
356 | 'password' => ['required', 'string', 'min:8'], | 375 | 'password' => ['required', 'string', 'min:8'], |
357 | ]; | 376 | ]; |
358 | 377 | ||
359 | 378 | ||
360 | $messages = [ | 379 | $messages = [ |
361 | 'required' => 'Укажите обязательное поле', | 380 | 'required' => 'Укажите обязательное поле', |
362 | 'min' => [ | 381 | 'min' => [ |
363 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 382 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
364 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 383 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
365 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 384 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
366 | ], | 385 | ], |
367 | 'max' => [ | 386 | 'max' => [ |
368 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 387 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
369 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 388 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
370 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 389 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
371 | ] | 390 | ] |
372 | ]; | 391 | ]; |
373 | 392 | ||
374 | $email = $request->get('email'); | 393 | $email = $request->get('email'); |
375 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 394 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
376 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 395 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
377 | } | 396 | } |
378 | 397 | ||
379 | if ($request->get('password') !== $request->get('confirmed')){ | 398 | if ($request->get('password') !== $request->get('confirmed')){ |
380 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 399 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
381 | } | 400 | } |
382 | 401 | ||
383 | if (strlen($request->get('password')) < 8) { | 402 | if (strlen($request->get('password')) < 8) { |
384 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 403 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
385 | } | 404 | } |
386 | 405 | ||
387 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 406 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
388 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 407 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
389 | 'X', 'C', 'V', 'B', 'N', 'M'); | 408 | 'X', 'C', 'V', 'B', 'N', 'M'); |
390 | $spec_bool = false; | 409 | $spec_bool = false; |
391 | $alpha_bool = false; | 410 | $alpha_bool = false; |
392 | 411 | ||
393 | $haystack = $request->get('password'); | 412 | $haystack = $request->get('password'); |
394 | 413 | ||
395 | foreach ($specsumbol as $it) { | 414 | foreach ($specsumbol as $it) { |
396 | if (strpos($haystack, $it) !== false) { | 415 | if (strpos($haystack, $it) !== false) { |
397 | $spec_bool = true; | 416 | $spec_bool = true; |
398 | } | 417 | } |
399 | } | 418 | } |
400 | 419 | ||
401 | foreach ($alpha as $it) { | 420 | foreach ($alpha as $it) { |
402 | if (strpos($haystack, $it) !== false) { | 421 | if (strpos($haystack, $it) !== false) { |
403 | $alpha_bool = true; | 422 | $alpha_bool = true; |
404 | } | 423 | } |
405 | } | 424 | } |
406 | 425 | ||
407 | if ((!$spec_bool) || (!$alpha_bool)) { | 426 | if ((!$spec_bool) || (!$alpha_bool)) { |
408 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 427 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
409 | } | 428 | } |
410 | 429 | ||
411 | if (empty($request->get('surname'))) { | 430 | if (empty($request->get('surname'))) { |
412 | $params['surname'] = 'Неизвестно'; | 431 | $params['surname'] = 'Неизвестно'; |
413 | } | 432 | } |
414 | if (empty($request->get('name_man'))) { | 433 | if (empty($request->get('name_man'))) { |
415 | $params['name_man'] = 'Неизвестно'; | 434 | $params['name_man'] = 'Неизвестно'; |
416 | } | 435 | } |
417 | $validator = Validator::make($params, $rules, $messages); | 436 | $validator = Validator::make($params, $rules, $messages); |
418 | 437 | ||
419 | if ($validator->fails()) { | 438 | if ($validator->fails()) { |
420 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 439 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
421 | } else { | 440 | } else { |
422 | $user = $this->create($params); | 441 | $user = $this->create($params); |
423 | event(new Registered($user)); | 442 | event(new Registered($user)); |
424 | Auth::guard()->login($user); | 443 | Auth::guard()->login($user); |
425 | } | 444 | } |
426 | 445 | ||
427 | if ($user) { | 446 | if ($user) { |
428 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | 447 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; |
429 | } else { | 448 | } else { |
430 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 449 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
431 | } | 450 | } |
432 | } | 451 | } |
433 | 452 | ||
434 | // Создание пользователя | 453 | // Создание пользователя |
435 | protected function create(array $data) | 454 | protected function create(array $data) |
436 | { | 455 | { |
437 | $Use = new User_Model(); | 456 | $Use = new User_Model(); |
438 | $Code_user = $Use->create([ | 457 | $Code_user = $Use->create([ |
439 | 'name' => $data['surname']." ".$data['name_man'], | 458 | 'name' => $data['surname']." ".$data['name_man'], |
440 | 'name_man' => $data['name_man'], | 459 | 'name_man' => $data['name_man'], |
441 | 'surname' => $data['surname'], | 460 | 'surname' => $data['surname'], |
442 | 'surname2' => $data['surname2'], | 461 | 'surname2' => $data['surname2'], |
443 | 'subscribe_email' => $data['email'], | 462 | 'subscribe_email' => $data['email'], |
444 | 'email' => $data['email'], | 463 | 'email' => $data['email'], |
445 | 'telephone' => $data['telephone'], | 464 | 'telephone' => $data['telephone'], |
446 | 'is_worker' => 0, | 465 | 'is_worker' => 0, |
447 | 'password' => Hash::make($data['password']), | 466 | 'password' => Hash::make($data['password']), |
448 | 'pubpassword' => base64_encode($data['password']), | 467 | 'pubpassword' => base64_encode($data['password']), |
449 | 'email_verified_at' => Carbon::now() | 468 | 'email_verified_at' => Carbon::now() |
450 | ]); | 469 | ]); |
451 | 470 | ||
452 | if ($Code_user->id > 0) { | 471 | if ($Code_user->id > 0) { |
453 | $Employer = new Employer(); | 472 | $Employer = new Employer(); |
454 | $Employer->user_id = $Code_user->id; | 473 | $Employer->user_id = $Code_user->id; |
455 | $Employer->name_company = $data['name_company']; | 474 | $Employer->name_company = $data['name_company']; |
456 | $Employer->email = $data['email']; | 475 | $Employer->email = $data['email']; |
457 | $Employer->telephone = $data['telephone']; | 476 | $Employer->telephone = $data['telephone']; |
458 | $Employer->code = Tools::generator_id(10); | 477 | $Employer->code = Tools::generator_id(10); |
459 | $Employer->save(); | 478 | $Employer->save(); |
460 | 479 | ||
461 | return $Code_user; | 480 | return $Code_user; |
462 | } | 481 | } |
463 | } | 482 | } |
464 | 483 | ||
465 | // Отправка сообщения от работодателя | 484 | // Отправка сообщения от работодателя |
466 | public function send_message(MessagesRequiest $request) { | 485 | public function send_message(MessagesRequiest $request) { |
467 | $params = $request->all(); | 486 | $params = $request->all(); |
468 | dd($params); | 487 | dd($params); |
469 | $user1 = $params['user_id']; | 488 | $user1 = $params['user_id']; |
470 | $user2 = $params['to_user_id']; | 489 | $user2 = $params['to_user_id']; |
471 | 490 | ||
472 | if ($request->has('file')) { | 491 | if ($request->has('file')) { |
473 | $params['file'] = $request->file('file')->store("messages", 'public'); | 492 | $params['file'] = $request->file('file')->store("messages", 'public'); |
474 | } | 493 | } |
475 | Message::create($params); | 494 | Message::create($params); |
476 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 495 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
477 | } | 496 | } |
478 | 497 | ||
479 | public function test123(Request $request) { | 498 | public function test123(Request $request) { |
480 | $params = $request->all(); | 499 | $params = $request->all(); |
481 | $user1 = $params['user_id']; | 500 | $user1 = $params['user_id']; |
482 | $user2 = $params['to_user_id']; | 501 | $user2 = $params['to_user_id']; |
483 | 502 | ||
484 | $rules = [ | 503 | $rules = [ |
485 | 'text' => 'required|min:1|max:150000', | 504 | 'text' => 'required|min:1|max:150000', |
486 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 505 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
487 | ]; | 506 | ]; |
488 | $messages = [ | 507 | $messages = [ |
489 | 'required' => 'Укажите обязательное поле', | 508 | 'required' => 'Укажите обязательное поле', |
490 | 'min' => [ | 509 | 'min' => [ |
491 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 510 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
492 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 511 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
493 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 512 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
494 | ], | 513 | ], |
495 | 'max' => [ | 514 | 'max' => [ |
496 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 515 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
497 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 516 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
498 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 517 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
499 | ] | 518 | ] |
500 | ]; | 519 | ]; |
501 | 520 | ||
502 | $validator = Validator::make($request->all(), $rules, $messages); | 521 | $validator = Validator::make($request->all(), $rules, $messages); |
503 | 522 | ||
504 | if ($validator->fails()) { | 523 | if ($validator->fails()) { |
505 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) | 524 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) |
506 | ->withErrors($validator); | 525 | ->withErrors($validator); |
507 | } else { | 526 | } else { |
508 | if ($request->has('file')) { | 527 | if ($request->has('file')) { |
509 | $params['file'] = $request->file('file')->store("messages", 'public'); | 528 | $params['file'] = $request->file('file')->store("messages", 'public'); |
510 | } | 529 | } |
511 | Message::create($params); | 530 | Message::create($params); |
512 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 531 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
513 | 532 | ||
514 | } | 533 | } |
515 | } | 534 | } |
516 | 535 | ||
517 | //Избранные люди | 536 | //Избранные люди |
518 | public function favorites(Request $request) { | 537 | public function favorites(Request $request) { |
519 | $IP_address = RusDate::ip_addr_client(); | 538 | $IP_address = RusDate::ip_addr_client(); |
520 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 539 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
521 | 540 | ||
522 | if ($Arr->count()) { | 541 | if ($Arr->count()) { |
523 | $A = Array(); | 542 | $A = Array(); |
524 | foreach ($Arr as $it) { | 543 | foreach ($Arr as $it) { |
525 | $A[] = $it->code_record; | 544 | $A[] = $it->code_record; |
526 | } | 545 | } |
527 | 546 | ||
528 | $Workers = Worker::query()->whereIn('id', $A); | 547 | $Workers = Worker::query()->whereIn('id', $A); |
529 | } else { | 548 | } else { |
530 | $Workers = Worker::query()->where('id', '=', '0'); | 549 | $Workers = Worker::query()->where('id', '=', '0'); |
531 | } | 550 | } |
532 | 551 | ||
533 | if (($request->has('search')) && (!empty($request->get('search')))) { | 552 | if (($request->has('search')) && (!empty($request->get('search')))) { |
534 | $search = $request->get('search'); | 553 | $search = $request->get('search'); |
535 | 554 | ||
536 | $Workers = $Workers->WhereHas('users', | 555 | $Workers = $Workers->WhereHas('users', |
537 | function (Builder $query) use ($search) { | 556 | function (Builder $query) use ($search) { |
538 | $query->Where('surname', 'LIKE', "%$search%") | 557 | $query->Where('surname', 'LIKE', "%$search%") |
539 | ->orWhere('name_man', 'LIKE', "%$search%") | 558 | ->orWhere('name_man', 'LIKE', "%$search%") |
540 | ->orWhere('surname2', 'LIKE', "%$search%"); | 559 | ->orWhere('surname2', 'LIKE', "%$search%"); |
541 | }); | 560 | }); |
542 | } else { | 561 | } else { |
543 | $Workers = $Workers->with('users'); | 562 | $Workers = $Workers->with('users'); |
544 | } | 563 | } |
545 | 564 | ||
546 | $Workers = $Workers->get(); | 565 | $Workers = $Workers->get(); |
547 | return view('employers.favorite', compact('Workers')); | 566 | return view('employers.favorite', compact('Workers')); |
548 | } | 567 | } |
549 | 568 | ||
550 | // База данных | 569 | // База данных |
551 | public function bd(Request $request) { | 570 | public function bd(Request $request) { |
552 | // для типа BelongsTo | 571 | // для типа BelongsTo |
553 | //$documents = Document::query()->orderBy(Location::select('name') | 572 | //$documents = Document::query()->orderBy(Location::select('name') |
554 | // ->whereColumn('locations.id', 'documents.location_id') | 573 | // ->whereColumn('locations.id', 'documents.location_id') |
555 | //); | 574 | //); |
556 | 575 | ||
557 | // для типа HasOne/Many | 576 | // для типа HasOne/Many |
558 | // $documents = Document::::query()->orderBy(Location::select('name') | 577 | // $documents = Document::::query()->orderBy(Location::select('name') |
559 | // ->whereColumn('locations.document_id', 'documents.id') | 578 | // ->whereColumn('locations.document_id', 'documents.id') |
560 | //); | 579 | //); |
561 | 580 | ||
562 | 581 | ||
563 | $users = User_Model::query()->with('workers'); | 582 | $users = User_Model::query()->with('workers'); |
564 | 583 | ||
565 | if ($request->has('search')) { | 584 | if ($request->has('search')) { |
566 | $find_key = $request->get('search'); | 585 | $find_key = $request->get('search'); |
567 | $users = $users->where('name', 'LIKE', "%$find_key%") | 586 | $users = $users->where('name', 'LIKE', "%$find_key%") |
568 | ->orWhere('surname', 'LIKE', "%$find_key%") | 587 | ->orWhere('surname', 'LIKE', "%$find_key%") |
569 | ->orWhere('name_man', 'LIKE', "%$find_key%") | 588 | ->orWhere('name_man', 'LIKE', "%$find_key%") |
570 | ->orWhere('email', 'LIKE', "%$find_key%") | 589 | ->orWhere('email', 'LIKE', "%$find_key%") |
571 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 590 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
572 | } | 591 | } |
573 | 592 | ||
574 | // Данные | 593 | // Данные |
575 | $users = $users->Baseuser()-> | 594 | $users = $users->Baseuser()-> |
576 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id'))-> | 595 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id'))-> |
577 | paginate(5); | 596 | paginate(5); |
578 | 597 | ||
579 | 598 | ||
580 | return view('employers.bd', compact('users')); | 599 | return view('employers.bd', compact('users')); |
581 | } | 600 | } |
582 | 601 | ||
583 | //Настройка уведомлений | 602 | //Настройка уведомлений |
584 | public function subscribe() { | 603 | public function subscribe() { |
585 | return view('employers.subcribe'); | 604 | return view('employers.subcribe'); |
586 | } | 605 | } |
587 | 606 | ||
588 | //Установка уведомлений сохранение | 607 | //Установка уведомлений сохранение |
589 | public function save_subscribe(Request $request) { | 608 | public function save_subscribe(Request $request) { |
590 | dd($request->all()); | 609 | dd($request->all()); |
591 | $msg = $request->validate([ | 610 | $msg = $request->validate([ |
592 | 'subscribe_email' => 'required|email|min:5|max:255', | 611 | 'subscribe_email' => 'required|email|min:5|max:255', |
593 | ]); | 612 | ]); |
594 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); | 613 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); |
595 | } | 614 | } |
596 | 615 | ||
597 | //Сбросить форму с паролем | 616 | //Сбросить форму с паролем |
598 | public function password_reset() { | 617 | public function password_reset() { |
599 | $email = Auth()->user()->email; | 618 | $email = Auth()->user()->email; |
600 | return view('employers.password-reset', compact('email')); | 619 | return view('employers.password-reset', compact('email')); |
601 | } | 620 | } |
602 | 621 | ||
603 | //Обновление пароля | 622 | //Обновление пароля |
604 | public function new_password(Request $request) { | 623 | public function new_password(Request $request) { |
605 | $use = Auth()->user(); | 624 | $use = Auth()->user(); |
606 | $request->validate([ | 625 | $request->validate([ |
607 | 'password' => 'required|string', | 626 | 'password' => 'required|string', |
608 | 'new_password' => 'required|string', | 627 | 'new_password' => 'required|string', |
609 | 'new_password2' => 'required|string' | 628 | 'new_password2' => 'required|string' |
610 | ]); | 629 | ]); |
611 | 630 | ||
612 | if ($request->get('new_password') == $request->get('new_password2')) | 631 | if ($request->get('new_password') == $request->get('new_password2')) |
613 | if ($request->get('password') !== $request->get('new_password')) { | 632 | if ($request->get('password') !== $request->get('new_password')) { |
614 | $credentials = $request->only('email', 'password'); | 633 | $credentials = $request->only('email', 'password'); |
615 | if (Auth::attempt($credentials)) { | 634 | if (Auth::attempt($credentials)) { |
616 | 635 | ||
617 | if (!is_null($use->email_verified_at)){ | 636 | if (!is_null($use->email_verified_at)){ |
618 | 637 | ||
619 | $user_data = User_Model::find($use->id); | 638 | $user_data = User_Model::find($use->id); |
620 | $user_data->update([ | 639 | $user_data->update([ |
621 | 'password' => Hash::make($request->get('new_password')), | 640 | 'password' => Hash::make($request->get('new_password')), |
622 | 'pubpassword' => base64_encode($request->get('new_password')), | 641 | 'pubpassword' => base64_encode($request->get('new_password')), |
623 | ]); | 642 | ]); |
624 | return redirect() | 643 | return redirect() |
625 | ->route('employer.password_reset') | 644 | ->route('employer.password_reset') |
626 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 645 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
627 | } | 646 | } |
628 | 647 | ||
629 | return redirect() | 648 | return redirect() |
630 | ->route('employer.password_reset') | 649 | ->route('employer.password_reset') |
631 | ->withError('Данная учетная запись не было верифицированна!'); | 650 | ->withError('Данная учетная запись не было верифицированна!'); |
632 | } | 651 | } |
633 | } | 652 | } |
634 | 653 | ||
635 | return redirect() | 654 | return redirect() |
636 | ->route('employer.password_reset') | 655 | ->route('employer.password_reset') |
637 | ->withErrors('Не совпадение данных, обновите пароли!'); | 656 | ->withErrors('Не совпадение данных, обновите пароли!'); |
638 | } | 657 | } |
639 | 658 | ||
640 | 659 | ||
641 | 660 | ||
642 | // Форма Удаление пипла | 661 | // Форма Удаление пипла |
643 | public function delete_people() { | 662 | public function delete_people() { |
644 | $login = Auth()->user()->email; | 663 | $login = Auth()->user()->email; |
645 | return view('employers.delete_people', compact('login')); | 664 | return view('employers.delete_people', compact('login')); |
646 | } | 665 | } |
647 | 666 | ||
648 | // Удаление аккаунта | 667 | // Удаление аккаунта |
649 | public function action_delete_user(Request $request) { | 668 | public function action_delete_user(Request $request) { |
650 | $Answer = $request->all(); | 669 | $Answer = $request->all(); |
651 | $user_id = Auth()->user()->id; | 670 | $user_id = Auth()->user()->id; |
652 | $request->validate([ | 671 | $request->validate([ |
653 | 'password' => 'required|string', | 672 | 'password' => 'required|string', |
654 | ]); | 673 | ]); |
655 | 674 | ||
656 | $credentials = $request->only('email', 'password'); | 675 | $credentials = $request->only('email', 'password'); |
657 | if (Auth::attempt($credentials)) { | 676 | if (Auth::attempt($credentials)) { |
658 | Auth::logout(); | 677 | Auth::logout(); |
659 | $it = User_Model::find($user_id); | 678 | $it = User_Model::find($user_id); |
660 | $it->delete(); | 679 | $it->delete(); |
661 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 680 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
662 | } else { | 681 | } else { |
663 | return redirect()->route('employer.delete_people') | 682 | return redirect()->route('employer.delete_people') |
664 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 683 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
665 | } | 684 | } |
666 | } | 685 | } |
667 | 686 | ||
668 | public function ajax_delete_user(Request $request) { | 687 | public function ajax_delete_user(Request $request) { |
669 | $Answer = $request->all(); | 688 | $Answer = $request->all(); |
670 | $user_id = Auth()->user()->id; | 689 | $user_id = Auth()->user()->id; |
671 | $request->validate([ | 690 | $request->validate([ |
672 | 'password' => 'required|string', | 691 | 'password' => 'required|string', |
673 | ]); | 692 | ]); |
674 | $credentials = $request->only('email', 'password'); | 693 | $credentials = $request->only('email', 'password'); |
675 | if (Auth::attempt($credentials)) { | 694 | if (Auth::attempt($credentials)) { |
676 | 695 | ||
677 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', | 696 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', |
678 | 'email' => $request->get('email'), | 697 | 'email' => $request->get('email'), |
679 | 'password' => $request->get('password'))); | 698 | 'password' => $request->get('password'))); |
680 | } else { | 699 | } else { |
681 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); | 700 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); |
682 | } | 701 | } |
683 | } | 702 | } |
684 | 703 | ||
685 | // FAQ - Вопросы/ответы для работодателей и соискателей | 704 | // FAQ - Вопросы/ответы для работодателей и соискателей |
686 | public function faq() { | 705 | public function faq() { |
687 | return view('employers.faq'); | 706 | return view('employers.faq'); |
688 | } | 707 | } |
689 | 708 | ||
690 | // Рассылка сообщений | 709 | // Рассылка сообщений |
691 | public function send_all_messages() { | 710 | public function send_all_messages() { |
692 | return view('employers.send_all'); | 711 | return view('employers.send_all'); |
693 | } | 712 | } |
694 | 713 | ||
695 | // Отправка сообщений для информации | 714 | // Отправка сообщений для информации |
696 | public function send_all_post(Request $request) { | 715 | public function send_all_post(Request $request) { |
697 | $data = $request->all(); | 716 | $data = $request->all(); |
698 | 717 | ||
699 | $emails = User_Model::query()->where('is_worker', '1')->get(); | 718 | $emails = User_Model::query()->where('is_worker', '1')->get(); |
700 | 719 | ||
701 | foreach ($emails as $e) { | 720 | foreach ($emails as $e) { |
702 | Mail::to($e->email)->send(new SendAllMessages($data)); | 721 | Mail::to($e->email)->send(new SendAllMessages($data)); |
703 | } | 722 | } |
704 | 723 | ||
705 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); | 724 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); |
706 | } | 725 | } |
707 | 726 | ||
708 | // База резюме | 727 | // База резюме |
709 | public function bd_tupe(Request $request) { | 728 | public function bd_tupe(Request $request) { |
710 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); | 729 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); |
711 | 730 | ||
712 | return view('employers.bd_tupe', compact('Resume')); | 731 | return view('employers.bd_tupe', compact('Resume')); |
713 | } | 732 | } |
714 | 733 | ||
715 | ////////////////////////////////////////////////////////////////// | 734 | ////////////////////////////////////////////////////////////////// |
716 | // Отправил сообщение | 735 | // Отправил сообщение |
717 | ////////////////////////////////////////////////////////////////// | 736 | ////////////////////////////////////////////////////////////////// |
718 | public function new_message(Request $request) { | 737 | public function new_message(Request $request) { |
719 | $params = $request->all(); | 738 | $params = $request->all(); |
720 | $id = $params['_user_id']; | 739 | $id = $params['_user_id']; |
721 | $message = new Message(); | 740 | $message = new Message(); |
722 | $message->user_id = $params['_user_id']; | 741 | $message->user_id = $params['_user_id']; |
723 | $message->to_user_id = $params['_to_user_id']; | 742 | $message->to_user_id = $params['_to_user_id']; |
724 | $message->title = $params['title']; | 743 | $message->title = $params['title']; |
725 | $message->text = $params['text']; | 744 | $message->text = $params['text']; |
726 | if ($request->has('_file')) { | 745 | if ($request->has('_file')) { |
727 | $message->file = $request->file('_file')->store("worker/$id", 'public'); | 746 | $message->file = $request->file('_file')->store("worker/$id", 'public'); |
728 | } | 747 | } |
729 | $message->ad_employer_id = $params['_vacancy']; | 748 | $message->ad_employer_id = $params['_vacancy']; |
730 | $message->flag_new = 1; | 749 | $message->flag_new = 1; |
731 | $id_message = $message->save(); | 750 | $id_message = $message->save(); |
732 | 751 | ||
733 | //$data['message_id'] = $id_message; | 752 | //$data['message_id'] = $id_message; |
734 | //$data['ad_employer_id'] = $params['_vacancy']; | 753 | //$data['ad_employer_id'] = $params['_vacancy']; |
735 | //$data['job_title_id'] = 0; | 754 | //$data['job_title_id'] = 0; |
736 | 755 | ||
737 | $data['flag'] = 1; | 756 | $data['flag'] = 1; |
738 | //$ad_responce = ad_response::create($data); | 757 | //$ad_responce = ad_response::create($data); |
739 | return redirect()->route('employer.messages', ['type_message' => 'output']); | 758 | return redirect()->route('employer.messages', ['type_message' => 'output']); |
740 | } | 759 | } |
741 | 760 | ||
742 | // Восстановление пароля | 761 | // Восстановление пароля |
app/Http/Controllers/MainController.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\Mail\MailRegistration; | 7 | use App\Mail\MailRegistration; |
8 | use App\Mail\MailRepair; | 8 | use App\Mail\MailRepair; |
9 | use App\Models\Ad_employer; | 9 | use App\Models\Ad_employer; |
10 | use App\Models\Ad_jobs; | 10 | use App\Models\Ad_jobs; |
11 | use App\Models\Category; | 11 | use App\Models\Category; |
12 | use App\Models\Education; | 12 | use App\Models\Education; |
13 | use App\Models\Employer; | 13 | use App\Models\Employer; |
14 | use App\Models\employers_main; | 14 | use App\Models\employers_main; |
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\Like_worker; | 17 | use App\Models\Like_worker; |
18 | use App\Models\News; | 18 | use App\Models\News; |
19 | use App\Models\Positions; | 19 | use App\Models\Positions; |
20 | use App\Models\reclame; | 20 | use App\Models\reclame; |
21 | use App\Models\User; | 21 | use App\Models\User; |
22 | use Illuminate\Http\Request; | 22 | use Illuminate\Http\Request; |
23 | use Illuminate\Support\Facades\Auth; | 23 | use Illuminate\Support\Facades\Auth; |
24 | use Illuminate\Support\Facades\DB; | 24 | use Illuminate\Support\Facades\DB; |
25 | use Illuminate\Support\Facades\Hash; | 25 | use Illuminate\Support\Facades\Hash; |
26 | use Illuminate\Support\Facades\Mail; | 26 | use Illuminate\Support\Facades\Mail; |
27 | use Illuminate\Support\Facades\Validator; | 27 | use Illuminate\Support\Facades\Validator; |
28 | use App\Classes\StatusUser; | 28 | use App\Classes\StatusUser; |
29 | 29 | ||
30 | class MainController extends Controller | 30 | class MainController extends Controller |
31 | { | 31 | { |
32 | // Главная страница публичной части | 32 | // Главная страница публичной части |
33 | public function index() { | 33 | public function index() { |
34 | $news = News::query()->orderByDesc('id')->limit(6)->get(); | 34 | $news = News::query()->orderByDesc('id')->limit(6)->get(); |
35 | 35 | ||
36 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') | 36 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') |
37 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') | 37 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') |
38 | ->OrderByDesc('created_at') | 38 | ->OrderByDesc('created_at') |
39 | ->GroupBy('categories.id') | 39 | ->GroupBy('categories.id') |
40 | ->get(); | 40 | ->get(); |
41 | 41 | ||
42 | $Position = Category::query()->where('is_remove', '=', '0')->get(); | 42 | $Position = Category::query()->where('is_remove', '=', '0')->get(); |
43 | $job_titles = Job_title::query()->where('is_remove', '=', 0)->get(); | 43 | $job_titles = Job_title::query()->where('is_remove', '=', 0)->get(); |
44 | /*$BigFlot = Array(); | 44 | /*$BigFlot = Array(); |
45 | foreach ($Position as $position) { | 45 | foreach ($Position as $position) { |
46 | $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | 46 | $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> |
47 | orderBy('job_titles.sort')-> | 47 | orderBy('job_titles.sort')-> |
48 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 48 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
49 | where('position_ship', "$position->name")-> | 49 | where('position_ship', "$position->name")-> |
50 | groupby('job_title_id','position_ship')-> | 50 | groupby('job_title_id','position_ship')-> |
51 | get(); | 51 | get(); |
52 | } | 52 | } |
53 | $BigFlot = Array(); | 53 | $BigFlot = Array(); |
54 | foreach ($Position as $position) { | 54 | foreach ($Position as $position) { |
55 | $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { | 55 | $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { |
56 | $query->OrderBy('sort'); | 56 | $query->OrderBy('sort'); |
57 | }])->whereHas('job_title', function ($query) use ($position) { | 57 | }])->whereHas('job_title', function ($query) use ($position) { |
58 | $query->where('position_id', $position->id); | 58 | $query->where('position_id', $position->id); |
59 | })-> | 59 | })-> |
60 | distinct('job_title_id')-> | 60 | distinct('job_title_id')-> |
61 | get(); | 61 | get(); |
62 | }*/ | 62 | }*/ |
63 | /*$BigFlot = Array(); | 63 | /*$BigFlot = Array(); |
64 | foreach ($Position as $position) { | 64 | foreach ($Position as $position) { |
65 | $BigFlot[$position->id] = DB::table('ad_jobs')-> | 65 | $BigFlot[$position->id] = DB::table('ad_jobs')-> |
66 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> | 66 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> |
67 | orderByDesc('job_titles.sort')-> | 67 | orderByDesc('job_titles.sort')-> |
68 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 68 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
69 | where('job_titles.position_id', $position->id)-> | 69 | where('job_titles.position_id', $position->id)-> |
70 | groupby('job_title_id')-> | 70 | groupby('job_title_id')-> |
71 | get(); | 71 | get(); |
72 | }*/ | 72 | }*/ |
73 | $Data = DB::table('job_titles')-> | 73 | $Data = DB::table('job_titles')-> |
74 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> | 74 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> |
75 | where('categories.is_remove', '=', '0')-> | 75 | where('categories.is_remove', '=', '0')-> |
76 | where('job_titles.is_remove', '=', '0')-> | 76 | where('job_titles.is_remove', '=', '0')-> |
77 | leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> | 77 | leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> |
78 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> | 78 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> |
79 | groupBy('job_titles.id')->orderByDesc('job_titles.position_id')-> | 79 | groupBy('job_titles.id')->orderByDesc('job_titles.position_id')-> |
80 | orderByDesc('job_titles.sort')->get()->toArray(); | 80 | orderByDesc('job_titles.sort')->get()->toArray(); |
81 | 81 | ||
82 | $Main_Job = array(); | 82 | $Main_Job = array(); |
83 | $name_cat = ''; | 83 | $name_cat = ''; |
84 | foreach ($Data as $it) { | 84 | foreach ($Data as $it) { |
85 | $it_arr = (array)$it; | 85 | $it_arr = (array)$it; |
86 | if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname']; | 86 | if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname']; |
87 | $Main_Job[$name_cat][] = $it_arr; | 87 | $Main_Job[$name_cat][] = $it_arr; |
88 | } | 88 | } |
89 | 89 | ||
90 | $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get(); | 90 | $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get(); |
91 | $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); | 91 | $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); |
92 | return view('index', compact('news', 'job_titles', 'categories', 'employers', 'vacancy', 'Main_Job')); | 92 | return view('index', compact('news', 'job_titles', 'categories', 'employers', 'vacancy', 'Main_Job')); |
93 | } | 93 | } |
94 | 94 | ||
95 | public function search_vacancies(Request $request) { | 95 | public function search_vacancies(Request $request) { |
96 | if ($request->has('search')) { | 96 | if ($request->has('search')) { |
97 | $search = $request->get('search'); | 97 | $search = $request->get('search'); |
98 | $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); | 98 | $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); |
99 | if (isset($job_titles->id)) | 99 | if (isset($job_titles->id)) |
100 | if ($job_titles->id > 0) | 100 | if ($job_titles->id > 0) |
101 | return redirect()->route('vacancies', ['job' => $job_titles->id]); | 101 | return redirect()->route('vacancies', ['job' => $job_titles->id]); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | // Лайк вакансии | 105 | // Лайк вакансии |
106 | public function like_vacancy(Request $request) { | 106 | public function like_vacancy(Request $request) { |
107 | $IP_address = RusDate::ip_addr_client(); | 107 | $IP_address = RusDate::ip_addr_client(); |
108 | 108 | ||
109 | if ($request->has('code_record')) { | 109 | if ($request->has('code_record')) { |
110 | if ($request->has('delete')) { | 110 | if ($request->has('delete')) { |
111 | $atomic_era = Like_vacancy::select('id')-> | 111 | $atomic_era = Like_vacancy::select('id')-> |
112 | where('code_record', '=', $request-> | 112 | where('code_record', '=', $request-> |
113 | get('code_record'))->first(); | 113 | get('code_record'))->first(); |
114 | 114 | ||
115 | DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); | 115 | DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); |
116 | 116 | ||
117 | } else { | 117 | } else { |
118 | $params = $request->all(); | 118 | $params = $request->all(); |
119 | $params['ip_address'] = $IP_address; | 119 | $params['ip_address'] = $IP_address; |
120 | Like_vacancy::create($params); | 120 | Like_vacancy::create($params); |
121 | } | 121 | } |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | // Лайк соискателю. | 125 | // Лайк соискателю. |
126 | public function like_worker(Request $request) { | 126 | public function like_worker(Request $request) { |
127 | $IP_address = RusDate::ip_addr_client(); | 127 | $IP_address = RusDate::ip_addr_client(); |
128 | 128 | ||
129 | if ($request->has('code_record')) { | 129 | if ($request->has('code_record')) { |
130 | if ($request->has('delete')) { | 130 | if ($request->has('delete')) { |
131 | $atomic_era = Like_worker::select('id')-> | 131 | $atomic_era = Like_worker::select('id')-> |
132 | where('code_record', '=', $request-> | 132 | where('code_record', '=', $request-> |
133 | get('code_record'))->first(); | 133 | get('code_record'))->first(); |
134 | 134 | ||
135 | DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); | 135 | DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); |
136 | 136 | ||
137 | return "Вот и результат удаления!"; | 137 | return "Вот и результат удаления!"; |
138 | 138 | ||
139 | } else { | 139 | } else { |
140 | $params = $request->all(); | 140 | $params = $request->all(); |
141 | $params['ip_address'] = $IP_address; | 141 | $params['ip_address'] = $IP_address; |
142 | Like_worker::create($params); | 142 | Like_worker::create($params); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | public function vacancies(Request $request) { | 147 | public function vacancies(Request $request) { |
148 | //должности | 148 | //должности |
149 | $Job_title = Job_title::query()->where('is_remove', '=', '0')->orderBy('name')->get(); | 149 | $Job_title = Job_title::query()->where('is_remove', '=', '0')->orderBy('name')->get(); |
150 | 150 | ||
151 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') | 151 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') |
152 | ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') | 152 | ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') |
153 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') | 153 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') |
154 | ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); | 154 | ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); |
155 | 155 | ||
156 | //категории и вакансии | 156 | //категории и вакансии |
157 | if (($request->has('job')) && ($request->get('job') > 0)) { | 157 | if (($request->has('job')) && ($request->get('job') > 0)) { |
158 | $categories = $categories->Where('job_title_id', '=', $request->get('job')); | 158 | $categories = $categories->Where('job_title_id', '=', $request->get('job')); |
159 | } | 159 | } |
160 | 160 | ||
161 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); | 161 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); |
162 | 162 | ||
163 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); | 163 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); |
164 | 164 | ||
165 | /*$BigFlot = Array(); | 165 | /*$BigFlot = Array(); |
166 | foreach ($Position as $position) { | 166 | foreach ($Position as $position) { |
167 | $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | 167 | $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> |
168 | orderBy('job_titles.sort')-> | 168 | orderBy('job_titles.sort')-> |
169 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 169 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
170 | where('position_ship', "$position->name"); | 170 | where('position_ship', "$position->name"); |
171 | if (($request->has('job')) && ($request->get('job') > 0)) { | 171 | if (($request->has('job')) && ($request->get('job') > 0)) { |
172 | $War_flot = $War_flot->where('job_title_id', $request->get('job')); | 172 | $War_flot = $War_flot->where('job_title_id', $request->get('job')); |
173 | } | 173 | } |
174 | $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); | 174 | $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); |
175 | $BigFlot[] = $War_flot; | 175 | $BigFlot[] = $War_flot; |
176 | }*/ | 176 | }*/ |
177 | /* | 177 | /* |
178 | $BigFlot = Array(); | 178 | $BigFlot = Array(); |
179 | foreach ($Position as $position) { | 179 | foreach ($Position as $position) { |
180 | $WarFlot = DB::table('ad_jobs')-> | 180 | $WarFlot = DB::table('ad_jobs')-> |
181 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> | 181 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> |
182 | orderByDesc('job_titles.sort')-> | 182 | orderByDesc('job_titles.sort')-> |
183 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 183 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
184 | where('job_titles.position_id', $position->id); | 184 | where('job_titles.position_id', $position->id); |
185 | if (($request->has('job')) && ($request->get('job') > 0)) { | 185 | if (($request->has('job')) && ($request->get('job') > 0)) { |
186 | $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); | 186 | $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); |
187 | } | 187 | } |
188 | $WarFlot = $WarFlot->groupby('job_title_id')->get(); | 188 | $WarFlot = $WarFlot->groupby('job_title_id')->get(); |
189 | $BigFlot[] = $WarFlot; | 189 | $BigFlot[] = $WarFlot; |
190 | } | 190 | } |
191 | */ | 191 | */ |
192 | 192 | ||
193 | $Data = DB::table('job_titles')-> | 193 | $Data = DB::table('job_titles')-> |
194 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> | 194 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> |
195 | where('categories.is_remove', '=', '0')-> | 195 | where('categories.is_remove', '=', '0')-> |
196 | where('job_titles.is_remove', '=', '0'); | 196 | where('job_titles.is_remove', '=', '0'); |
197 | if (($request->has('job')) && ($request->get('job') > 0)) { | 197 | if (($request->has('job')) && ($request->get('job') > 0)) { |
198 | $Data = $Data->where('job_title_id', $request->get('job')); | 198 | $Data = $Data->where('job_title_id', $request->get('job')); |
199 | } | 199 | } |
200 | $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> | 200 | $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> |
201 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> | 201 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> |
202 | groupBy('job_titles.id')->orderByDesc('job_titles.position_id')-> | 202 | groupBy('job_titles.id')->orderByDesc('job_titles.position_id')-> |
203 | orderByDesc('job_titles.sort')->get()->toArray(); | 203 | orderByDesc('job_titles.sort')->get()->toArray(); |
204 | 204 | ||
205 | $Main_Job = array(); | 205 | $Main_Job = array(); |
206 | $name_cat = ''; | 206 | $name_cat = ''; |
207 | foreach ($Data as $it) { | 207 | foreach ($Data as $it) { |
208 | $it_arr = (array)$it; | 208 | $it_arr = (array)$it; |
209 | if ($name_cat != $it_arr['catname']) | 209 | if ($name_cat != $it_arr['catname']) |
210 | $name_cat = $it_arr['catname']; | 210 | $name_cat = $it_arr['catname']; |
211 | $Main_Job[$name_cat][] = $it_arr; | 211 | $Main_Job[$name_cat][] = $it_arr; |
212 | } | 212 | } |
213 | 213 | ||
214 | if ($request->ajax()) { | 214 | if ($request->ajax()) { |
215 | return view('ajax.new_sky', compact('categories', 'Main_Job')); | 215 | return view('ajax.new_sky', compact('categories', 'Main_Job')); |
216 | } else { | 216 | } else { |
217 | return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); | 217 | return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | //Вакансии категория детальная | 221 | //Вакансии категория детальная |
222 | public function list_vacancies(Category $categories, Request $request) { | 222 | public function list_vacancies(Category $categories, Request $request) { |
223 | if (isset(Auth()->user()->id)) | 223 | if (isset(Auth()->user()->id)) |
224 | $uid = Auth()->user()->id; | 224 | $uid = Auth()->user()->id; |
225 | else | 225 | else |
226 | $uid = 0; | 226 | $uid = 0; |
227 | 227 | ||
228 | if ($request->get('job') == 0) | 228 | if ($request->get('job') == 0) |
229 | $job_search = ''; | 229 | $job_search = ''; |
230 | else | 230 | else |
231 | $job_search = $request->get('job'); | 231 | $job_search = $request->get('job'); |
232 | 232 | ||
233 | $Query = Ad_employer::with('jobs')-> | 233 | $Query = Ad_employer::with('jobs')-> |
234 | with('cat')-> | 234 | with('cat')-> |
235 | with('employer')-> | 235 | with('employer')-> |
236 | 236 | ||
237 | whereHas('jobs_code', function ($query) use ($job_search) { | 237 | whereHas('jobs_code', function ($query) use ($job_search) { |
238 | if (!empty($job_search)) { | 238 | if (!empty($job_search)) { |
239 | $query->where('job_title_id', $job_search); | 239 | $query->where('job_title_id', $job_search); |
240 | } | 240 | } |
241 | })->select('ad_employers.*'); | 241 | })->select('ad_employers.*'); |
242 | 242 | ||
243 | if (isset($categories->id) && ($categories->id > 0)) { | 243 | if (isset($categories->id) && ($categories->id > 0)) { |
244 | $Query = $Query->where('category_id', '=', $categories->id); | 244 | $Query = $Query->where('category_id', '=', $categories->id); |
245 | $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); | 245 | $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); |
246 | } else { | 246 | } else { |
247 | $Name_categori = ''; | 247 | $Name_categori = ''; |
248 | } | 248 | } |
249 | 249 | ||
250 | if ($request->get('sort')) { | 250 | if ($request->get('sort')) { |
251 | $sort = $request->get('sort'); | 251 | $sort = $request->get('sort'); |
252 | switch ($sort) { | 252 | switch ($sort) { |
253 | case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; | 253 | case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; |
254 | case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; | 254 | case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; |
255 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; | 255 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; |
256 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; | 256 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; |
257 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 257 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
258 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 258 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
259 | } | 259 | } |
260 | } | 260 | } |
261 | 261 | ||
262 | $Job_title = Job_title::query()->OrderBy('name')->get(); | 262 | $Job_title = Job_title::query()->OrderBy('name')->get(); |
263 | 263 | ||
264 | $Query_count = $Query->count(); | 264 | $Query_count = $Query->count(); |
265 | 265 | ||
266 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 266 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
267 | 267 | ||
268 | $Reclama = reclame::query()->get(); | 268 | $Reclama = reclame::query()->get(); |
269 | 269 | ||
270 | if ($request->ajax()) { | 270 | if ($request->ajax()) { |
271 | if ($request->has('title')) { | 271 | if ($request->has('title')) { |
272 | return view('ajax.list_category', compact( | 272 | return view('ajax.list_category', compact( |
273 | 'Name_categori' | 273 | 'Name_categori' |
274 | )); | 274 | )); |
275 | } else { | 275 | } else { |
276 | return view('ajax.list_vacancies', compact('Query', | 276 | return view('ajax.list_vacancies', compact('Query', |
277 | 'Query_count', | 277 | 'Query_count', |
278 | 'Name_categori', | 278 | 'Name_categori', |
279 | 'Reclama', | 279 | 'Reclama', |
280 | 'categories', | 280 | 'categories', |
281 | 'Job_title', | 281 | 'Job_title', |
282 | 'uid')); | 282 | 'uid')); |
283 | } | 283 | } |
284 | } else { | 284 | } else { |
285 | //Вернуть все | 285 | //Вернуть все |
286 | return view('list_vacancies', compact('Query', | 286 | return view('list_vacancies', compact('Query', |
287 | 'Query_count', | 287 | 'Query_count', |
288 | 'Reclama', | 288 | 'Reclama', |
289 | 'Name_categori', | 289 | 'Name_categori', |
290 | 'categories', | 290 | 'categories', |
291 | 'Job_title', | 291 | 'Job_title', |
292 | 'uid')); | 292 | 'uid')); |
293 | } | 293 | } |
294 | } | 294 | } |
295 | 295 | ||
296 | // Образование | 296 | // Образование |
297 | public function education(Request $request) { | 297 | public function education(Request $request) { |
298 | $educations = Education::query(); | 298 | $educations = Education::query(); |
299 | if (($request->has('search')) && (!empty($request->get('search')))) { | 299 | if (($request->has('search')) && (!empty($request->get('search')))) { |
300 | $search = trim($request->get('search')); | 300 | $search = trim($request->get('search')); |
301 | $educations = $educations->where('name', 'LIKE', "%$search%"); | 301 | $educations = $educations->where('name', 'LIKE', "%$search%"); |
302 | } | 302 | } |
303 | 303 | ||
304 | if ($request->get('sort')) { | 304 | if ($request->get('sort')) { |
305 | $sort = $request->get('sort'); | 305 | $sort = $request->get('sort'); |
306 | switch ($sort) { | 306 | switch ($sort) { |
307 | case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; | 307 | case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; |
308 | case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; | 308 | case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; |
309 | case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; | 309 | case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; |
310 | case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; | 310 | case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; |
311 | case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; | 311 | case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; |
312 | default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; | 312 | default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | $count_edu = $educations->count(); | 316 | $count_edu = $educations->count(); |
317 | $educations = $educations->paginate(6); | 317 | $educations = $educations->paginate(6); |
318 | if ($request->ajax()) { | 318 | if ($request->ajax()) { |
319 | return view('ajax.education', compact('educations')); | 319 | return view('ajax.education', compact('educations')); |
320 | } else { | 320 | } else { |
321 | return view('education', compact('educations', 'count_edu')); | 321 | return view('education', compact('educations', 'count_edu')); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | 324 | ||
325 | // Контакты | 325 | // Контакты |
326 | public function contacts() { | 326 | public function contacts() { |
327 | return view('contacts'); | 327 | return view('contacts'); |
328 | } | 328 | } |
329 | 329 | ||
330 | // Вход в личный кабинет | 330 | // Вход в личный кабинет |
331 | public function input_login(Request $request) | 331 | public function input_login(Request $request) |
332 | { | 332 | { |
333 | $params = $request->all(); | 333 | $params = $request->all(); |
334 | 334 | ||
335 | 335 | ||
336 | $rules = [ | 336 | $rules = [ |
337 | 'email' => 'required|string|email', | 337 | 'email' => 'required|string|email', |
338 | 'password' => 'required|string|min:3|max:25', | 338 | 'password' => 'required|string|min:3|max:25', |
339 | ]; | 339 | ]; |
340 | 340 | ||
341 | $messages = [ | 341 | $messages = [ |
342 | 'required' => 'Укажите обязательное поле «:attribute»', | 342 | 'required' => 'Укажите обязательное поле «:attribute»', |
343 | 'email' => 'Введите корректный email', | 343 | 'email' => 'Введите корректный email', |
344 | 'min' => [ | 344 | 'min' => [ |
345 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 345 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
346 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 346 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
347 | ], | 347 | ], |
348 | 'max' => [ | 348 | 'max' => [ |
349 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 349 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
350 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 350 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
351 | ], | 351 | ], |
352 | ]; | 352 | ]; |
353 | |||
354 | $validator = Validator::make($request->all(), $rules, $messages); | 353 | $validator = Validator::make($request->all(), $rules, $messages); |
355 | |||
356 | |||
357 | if ($validator->fails()) { | 354 | if ($validator->fails()) { |
358 | return json_encode(Array("ERROR" => "Email или пароль невалидный!")); | 355 | $user_id = $request->user()->id; |
359 | //redirect()->route('index')->with('Error', "Email или пароль невалидный"); | 356 | if ($user_id > 0) |
357 | return json_encode(Array("ERROR" => "Email или пароль невалидный!")); | ||
358 | else | ||
359 | return redirect()->route('index')->with('Error', "Email или пароль невалидный"); | ||
360 | } else { | 360 | } else { |
361 | $credentials = $request->only('email', 'password'); | 361 | $credentials = $request->only('email', 'password'); |
362 | 362 | ||
363 | if (Auth::attempt($credentials, $request->has('remember'))) { | 363 | if (Auth::attempt($credentials, $request->has('remember'))) { |
364 | 364 | ||
365 | if (is_null(Auth::user()->email_verified_at)) { | 365 | if (is_null(Auth::user()->email_verified_at)) { |
366 | Auth::logout(); | 366 | Auth::logout(); |
367 | return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); | 367 | return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); |
368 | } | 368 | } |
369 | 369 | ||
370 | if (Auth::user()->is_worker) { | 370 | if (Auth::user()->is_worker) { |
371 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); | 371 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); |
372 | } else { | 372 | } else { |
373 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); | 373 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); |
374 | } | 374 | } |
375 | 375 | ||
376 | return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); | 376 | return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); |
377 | //->route('index') | 377 | //->route('index') |
378 | //->with('success', 'Вы вошли в личный кабинет.'); | 378 | //->with('success', 'Вы вошли в личный кабинет.'); |
379 | } else { | 379 | } else { |
380 | return json_encode(Array("ERROR" => "Неверный логин или пароль!")); | 380 | return json_encode(Array("ERROR" => "Неверный логин или пароль!")); |
381 | } | 381 | } |
382 | } | 382 | } |
383 | } | 383 | } |
384 | 384 | ||
385 | // Восстановление пароля | 385 | // Восстановление пароля |
386 | public function repair_password(Request $request) { | 386 | public function repair_password(Request $request) { |
387 | $rules = [ | 387 | $rules = [ |
388 | 'email' => 'required|string|email', | 388 | 'email' => 'required|string|email', |
389 | ]; | 389 | ]; |
390 | 390 | ||
391 | $messages = [ | 391 | $messages = [ |
392 | 'required' => 'Укажите обязательное поле «:attribute»', | 392 | 'required' => 'Укажите обязательное поле «:attribute»', |
393 | 'email' => 'Введите корректный email', | 393 | 'email' => 'Введите корректный email', |
394 | 'min' => [ | 394 | 'min' => [ |
395 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 395 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
396 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 396 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
397 | ], | 397 | ], |
398 | 'max' => [ | 398 | 'max' => [ |
399 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 399 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
400 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 400 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
401 | ], | 401 | ], |
402 | ]; | 402 | ]; |
403 | 403 | ||
404 | $validator = Validator::make($request->all(), $rules, $messages); | 404 | $validator = Validator::make($request->all(), $rules, $messages); |
405 | 405 | ||
406 | if ($validator->fails()) { | 406 | if ($validator->fails()) { |
407 | return redirect()->back()->with('Error', "Email невалидный"); | 407 | return redirect()->back()->with('Error', "Email невалидный"); |
408 | } else { | 408 | } else { |
409 | $new_password = Tools::generator_id(10); | 409 | $new_password = Tools::generator_id(10); |
410 | $hash_password = Hash::make($new_password); | 410 | $hash_password = Hash::make($new_password); |
411 | $user = User::query()->where('email', $request->get('email'))->first(); | 411 | $user = User::query()->where('email', $request->get('email'))->first(); |
412 | $EditRec = User::find($user->id); | 412 | $EditRec = User::find($user->id); |
413 | $EditRec->password = $hash_password; | 413 | $EditRec->password = $hash_password; |
414 | $EditRec->save(); | 414 | $EditRec->save(); |
415 | 415 | ||
416 | foreach ([$request->get('email')] as $recipient) { | 416 | foreach ([$request->get('email')] as $recipient) { |
417 | Mail::to($recipient)->send(new MailRepair($new_password)); | 417 | Mail::to($recipient)->send(new MailRepair($new_password)); |
418 | } | 418 | } |
419 | return redirect()->route('index'); | 419 | return redirect()->route('index'); |
420 | 420 | ||
421 | } | 421 | } |
422 | 422 | ||
423 | } | 423 | } |
424 | 424 | ||
425 | // Вывод новостей | 425 | // Вывод новостей |
426 | public function news(Request $request) { | 426 | public function news(Request $request) { |
427 | $Query = News::query(); | 427 | $Query = News::query(); |
428 | if ($request->has('search')) { | 428 | if ($request->has('search')) { |
429 | $search = $request->get('search'); | 429 | $search = $request->get('search'); |
430 | $Query = $Query->where('title', 'LIKE', "%$search%")-> | 430 | $Query = $Query->where('title', 'LIKE', "%$search%")-> |
431 | orWhere('text', 'LIKE', "%$search%"); | 431 | orWhere('text', 'LIKE', "%$search%"); |
432 | } | 432 | } |
433 | 433 | ||
434 | if ($request->ajax()) { | 434 | if ($request->ajax()) { |
435 | if ($request->get('sort')) { | 435 | if ($request->get('sort')) { |
436 | $sort = $request->get('sort'); | 436 | $sort = $request->get('sort'); |
437 | switch ($sort) { | 437 | switch ($sort) { |
438 | case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; | 438 | case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; |
439 | case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; | 439 | case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; |
440 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; | 440 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; |
441 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; | 441 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; |
442 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 442 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
443 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 443 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
444 | } | 444 | } |
445 | } | 445 | } |
446 | } | 446 | } |
447 | $Query_count = $Query->count(); | 447 | $Query_count = $Query->count(); |
448 | $Query = $Query->paginate(6); | 448 | $Query = $Query->paginate(6); |
449 | 449 | ||
450 | if ($request->ajax()) { | 450 | if ($request->ajax()) { |
451 | return view('ajax.news-list', compact('Query', 'Query_count')); | 451 | return view('ajax.news-list', compact('Query', 'Query_count')); |
452 | } else { | 452 | } else { |
453 | return view('news-list', compact('Query', 'Query_count')); | 453 | return view('news-list', compact('Query', 'Query_count')); |
454 | } | 454 | } |
455 | } | 455 | } |
456 | 456 | ||
457 | //Детальная новость | 457 | //Детальная новость |
458 | public function detail_new(News $new) { | 458 | public function detail_new(News $new) { |
459 | // Наборка | 459 | // Наборка |
460 | $Query = News::query()->where('id', $new->id)->get(); | 460 | $Query = News::query()->where('id', $new->id)->get(); |
461 | $title = $Query[0]->title; | 461 | $title = $Query[0]->title; |
462 | $All_Query = News::query()->paginate(8); | 462 | $All_Query = News::query()->paginate(8); |
463 | return view('detail_new', compact('Query', 'All_Query', 'title')); | 463 | return view('detail_new', compact('Query', 'All_Query', 'title')); |
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\Http\Requests\DocumentsRequest; | 6 | use App\Http\Requests\DocumentsRequest; |
7 | use App\Http\Requests\PrevCompanyRequest; | 7 | use App\Http\Requests\PrevCompanyRequest; |
8 | use App\Http\Requests\SertificationRequest; | 8 | use App\Http\Requests\SertificationRequest; |
9 | use App\Models\Ad_employer; | 9 | use App\Models\Ad_employer; |
10 | use App\Models\ad_response; | 10 | use App\Models\ad_response; |
11 | use App\Models\Category; | 11 | use App\Models\Category; |
12 | use App\Models\Dop_info; | 12 | use App\Models\Dop_info; |
13 | use App\Models\Employer; | 13 | use App\Models\Employer; |
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\Like_worker; | 17 | use App\Models\Like_worker; |
18 | use App\Models\Message; | 18 | use App\Models\Message; |
19 | use App\Models\place_works; | 19 | use App\Models\place_works; |
20 | use App\Models\PrevCompany; | 20 | use App\Models\PrevCompany; |
21 | use App\Models\reclame; | 21 | use App\Models\reclame; |
22 | use App\Models\ResponseWork; | 22 | use App\Models\ResponseWork; |
23 | use App\Models\sertification; | 23 | use App\Models\sertification; |
24 | use App\Models\Static_worker; | 24 | use App\Models\Static_worker; |
25 | use App\Models\Title_worker; | 25 | use App\Models\Title_worker; |
26 | use App\Models\User; | 26 | use App\Models\User; |
27 | use App\Models\User as User_Model; | 27 | use App\Models\User as User_Model; |
28 | use App\Models\Worker; | 28 | use App\Models\Worker; |
29 | use Barryvdh\DomPDF\Facade\Pdf; | 29 | use Barryvdh\DomPDF\Facade\Pdf; |
30 | use Carbon\Carbon; | 30 | use Carbon\Carbon; |
31 | use Illuminate\Auth\Events\Registered; | 31 | use Illuminate\Auth\Events\Registered; |
32 | use Illuminate\Database\Eloquent\Builder; | 32 | use Illuminate\Database\Eloquent\Builder; |
33 | use Illuminate\Database\Eloquent\Model; | 33 | use Illuminate\Database\Eloquent\Model; |
34 | use Illuminate\Http\JsonResponse; | 34 | use Illuminate\Http\JsonResponse; |
35 | use Illuminate\Http\Request; | 35 | use Illuminate\Http\Request; |
36 | use Illuminate\Support\Facades\Auth; | 36 | use Illuminate\Support\Facades\Auth; |
37 | use Illuminate\Support\Facades\Hash; | 37 | use Illuminate\Support\Facades\Hash; |
38 | use Illuminate\Support\Facades\Storage; | 38 | use Illuminate\Support\Facades\Storage; |
39 | use Illuminate\Support\Facades\Validator; | 39 | use Illuminate\Support\Facades\Validator; |
40 | 40 | ||
41 | class WorkerController extends Controller | 41 | class WorkerController extends Controller |
42 | { | 42 | { |
43 | public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); | 43 | public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); |
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 | $idiot = Auth()->user()->id; | 77 | $idiot = Auth()->user()->id; |
78 | } else { | 78 | } else { |
79 | $idiot = 0; | 79 | $idiot = 0; |
80 | } | 80 | } |
81 | 81 | ||
82 | $status_work = $this->status_work; | 82 | $status_work = $this->status_work; |
83 | $resumes = Worker::query()->with('users')->with('job_titles'); | 83 | $resumes = Worker::query()->with('users')->with('job_titles'); |
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 | //dd($request->get('job')); | 89 | //dd($request->get('job')); |
90 | if (($request->has('job')) && ($request->get('job') > 0)) { | 90 | if (($request->has('job')) && ($request->get('job') > 0)) { |
91 | $resumes = $resumes->whereHas('job_titles', function(Builder $query) use ($request) { | 91 | $resumes = $resumes->whereHas('job_titles', function(Builder $query) use ($request) { |
92 | $query->Where('job_titles.id', $request->get('job')); | 92 | $query->Where('job_titles.id', $request->get('job')); |
93 | }); | 93 | }); |
94 | } | 94 | } |
95 | 95 | ||
96 | $Job_title = Job_title::query()->get(); | 96 | $Job_title = Job_title::query()->get(); |
97 | 97 | ||
98 | if ($request->get('sort')) { | 98 | if ($request->get('sort')) { |
99 | $sort = $request->get('sort'); | 99 | $sort = $request->get('sort'); |
100 | switch ($sort) { | 100 | switch ($sort) { |
101 | case 'name_up': | 101 | case 'name_up': |
102 | $resumes = $resumes->orderBy(User::select('surname') | 102 | $resumes = $resumes->orderBy(User::select('surname') |
103 | ->whereColumn('Workers.user_id', 'users.id') | 103 | ->whereColumn('Workers.user_id', 'users.id') |
104 | ); | 104 | ); |
105 | break; | 105 | break; |
106 | case 'name_down': | 106 | case 'name_down': |
107 | $resumes = $resumes->orderByDesc(User::select('surname') | 107 | $resumes = $resumes->orderByDesc(User::select('surname') |
108 | ->whereColumn('Workers.user_id', 'users.id') | 108 | ->whereColumn('Workers.user_id', 'users.id') |
109 | ); | 109 | ); |
110 | break; | 110 | break; |
111 | case 'created_at_up': $resumes = $resumes->OrderBy('created_at')->orderBy('id'); break; | 111 | case 'created_at_up': $resumes = $resumes->OrderBy('created_at')->orderBy('id'); break; |
112 | case 'created_at_down': $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); break; | 112 | case 'created_at_down': $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); break; |
113 | case 'default': $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; | 113 | case 'default': $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; |
114 | default: $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; | 114 | default: $resumes = $resumes->orderBy('id')->orderby('updated_at'); break; |
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | $res_count = $resumes->count(); | 118 | $res_count = $resumes->count(); |
119 | //$resumes = $resumes->get(); | 119 | //$resumes = $resumes->get(); |
120 | 120 | ||
121 | $resumes = $resumes->paginate(4); | 121 | $resumes = $resumes->paginate(4); |
122 | if ($request->ajax()) { | 122 | if ($request->ajax()) { |
123 | // Условия обставлены | 123 | // Условия обставлены |
124 | if ($request->has('block') && ($request->get('block') == 1)) { | 124 | if ($request->has('block') && ($request->get('block') == 1)) { |
125 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); | 125 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); |
126 | } | 126 | } |
127 | 127 | ||
128 | if ($request->has('block') && ($request->get('block') == 2)) { | 128 | if ($request->has('block') && ($request->get('block') == 2)) { |
129 | return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); | 129 | return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); |
130 | } | 130 | } |
131 | } else { | 131 | } else { |
132 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); | 132 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | //Лайк резюме | 136 | //Лайк резюме |
137 | public function like_controller() { | 137 | public function like_controller() { |
138 | 138 | ||
139 | } | 139 | } |
140 | 140 | ||
141 | // анкета соискателя | 141 | // анкета соискателя |
142 | public function resume_profile(Worker $worker) | 142 | public function resume_profile(Worker $worker) |
143 | { | 143 | { |
144 | if (isset(Auth()->user()->id)) { | 144 | if (isset(Auth()->user()->id)) { |
145 | $idiot = Auth()->user()->id; | 145 | $idiot = Auth()->user()->id; |
146 | } else { | 146 | } else { |
147 | $idiot = 0; | 147 | $idiot = 0; |
148 | } | 148 | } |
149 | 149 | ||
150 | $status_work = $this->status_work; | 150 | $status_work = $this->status_work; |
151 | $Query = Worker::query()->with('users')->with('job_titles') | 151 | $Query = Worker::query()->with('users')->with('job_titles') |
152 | ->with('place_worker')->with('sertificate')->with('prev_company') | 152 | ->with('place_worker')->with('sertificate')->with('prev_company') |
153 | ->with('infobloks'); | 153 | ->with('infobloks'); |
154 | $Query = $Query->where('id', '=', $worker->id); | 154 | $Query = $Query->where('id', '=', $worker->id); |
155 | $Query = $Query->get(); | 155 | $Query = $Query->get(); |
156 | 156 | ||
157 | $get_date = date('Y.m'); | 157 | $get_date = date('Y.m'); |
158 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 158 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
159 | ->where('user_id', '=', $worker->id) | 159 | ->where('user_id', '=', $worker->id) |
160 | ->get(); | 160 | ->get(); |
161 | 161 | ||
162 | if ($c->count() > 0) { | 162 | if ($c->count() > 0) { |
163 | $upd = Static_worker::find($c[0]->id); | 163 | $upd = Static_worker::find($c[0]->id); |
164 | $upd->lookin = $upd->lookin + 1; | 164 | $upd->lookin = $upd->lookin + 1; |
165 | $upd->save(); | 165 | $upd->save(); |
166 | } else { | 166 | } else { |
167 | $crt = new Static_worker(); | 167 | $crt = new Static_worker(); |
168 | $crt->lookin = 1; | 168 | $crt->lookin = 1; |
169 | $crt->year_month = $get_date; | 169 | $crt->year_month = $get_date; |
170 | $crt->user_id = $worker->user_id; | 170 | $crt->user_id = $worker->user_id; |
171 | $crt->save(); | 171 | $crt->save(); |
172 | } | 172 | } |
173 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 173 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
174 | ->where('user_id', '=', $worker->id) | 174 | ->where('user_id', '=', $worker->id) |
175 | ->get(); | 175 | ->get(); |
176 | return view('worker', compact('Query', 'status_work', 'idiot')); | 176 | return view('worker', compact('Query', 'status_work', 'idiot')); |
177 | } | 177 | } |
178 | 178 | ||
179 | // скачать анкету соискателя | 179 | // скачать анкету соискателя |
180 | public function resume_download(Worker $worker) | 180 | public function resume_download(Worker $worker) |
181 | { | 181 | { |
182 | $status_work = $this->status_work; | 182 | $status_work = $this->status_work; |
183 | $Query = Worker::query()->with('users')->with('job_titles') | 183 | $Query = Worker::query()->with('users')->with('job_titles') |
184 | ->with('place_worker')->with('sertificate')->with('prev_company') | 184 | ->with('place_worker')->with('sertificate')->with('prev_company') |
185 | ->with('infobloks'); | 185 | ->with('infobloks'); |
186 | $Query = $Query->where('id', '=', $worker->id); | 186 | $Query = $Query->where('id', '=', $worker->id); |
187 | $Query = $Query->get()->toArray(); | 187 | $Query = $Query->get()->toArray(); |
188 | 188 | ||
189 | view()->share('Query',$Query); | 189 | view()->share('Query',$Query); |
190 | 190 | ||
191 | $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); | 191 | $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); |
192 | 192 | ||
193 | return $pdf->stream(); | 193 | return $pdf->stream(); |
194 | } | 194 | } |
195 | 195 | ||
196 | public function resume_download_all() { | 196 | public function resume_download_all() { |
197 | $status_work = $this->status_work; | 197 | $status_work = $this->status_work; |
198 | $Query = Worker::query()->with('users')->with('job_titles') | 198 | $Query = Worker::query()->with('users')->with('job_titles') |
199 | ->with('place_worker')->with('sertificate')->with('prev_company') | 199 | ->with('place_worker')->with('sertificate')->with('prev_company') |
200 | ->with('infobloks'); | 200 | ->with('infobloks'); |
201 | //$Query = $Query->where('id', '=', $worker->id); | 201 | //$Query = $Query->where('id', '=', $worker->id); |
202 | $Query = $Query->get()->toArray(); | 202 | $Query = $Query->get()->toArray(); |
203 | 203 | ||
204 | view()->share('Query',$Query); | 204 | view()->share('Query',$Query); |
205 | 205 | ||
206 | $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); | 206 | $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); |
207 | 207 | ||
208 | return $pdf->stream(); | 208 | return $pdf->stream(); |
209 | } | 209 | } |
210 | 210 | ||
211 | // Кабинет работника | 211 | // Кабинет работника |
212 | public function cabinet(Request $request) | 212 | public function cabinet(Request $request) |
213 | { | 213 | { |
214 | // дата год и месяц | 214 | // дата год и месяц |
215 | $get_date = date('Y.m'); | 215 | $get_date = date('Y.m'); |
216 | 216 | ||
217 | $id = Auth()->user()->id; | 217 | $id = Auth()->user()->id; |
218 | 218 | ||
219 | $Infobloks = infobloks::query()->get(); | 219 | $Infobloks = infobloks::query()->get(); |
220 | 220 | ||
221 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> | 221 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> |
222 | with('infobloks')->with('place_worker')-> | 222 | with('infobloks')->with('place_worker')-> |
223 | WhereHas('users', | 223 | WhereHas('users', |
224 | function (Builder $query) use ($id) {$query->Where('id', $id); | 224 | function (Builder $query) use ($id) {$query->Where('id', $id); |
225 | })->get(); | 225 | })->get(); |
226 | 226 | ||
227 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')->OrderBy('name')->get(); | 227 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')->OrderBy('name')->get(); |
228 | $Infoblocks = infobloks::query()->OrderBy('name')->get(); | 228 | $Infoblocks = infobloks::query()->OrderBy('name')->get(); |
229 | 229 | ||
230 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 230 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
231 | ->where('user_id', '=', $Worker[0]->id) | 231 | ->where('user_id', '=', $Worker[0]->id) |
232 | ->get(); | 232 | ->get(); |
233 | 233 | ||
234 | // 10% | 234 | // 10% |
235 | 235 | ||
236 | $persent = 10; | 236 | $persent = 10; |
237 | $persent1 = 0; | 237 | $persent1 = 0; |
238 | $persent2 = 0; | 238 | $persent2 = 0; |
239 | $persent3 = 0; | 239 | $persent3 = 0; |
240 | $persent4 = 0; | 240 | $persent4 = 0; |
241 | $persent5 = 0; | 241 | $persent5 = 0; |
242 | 242 | ||
243 | if ((!empty($Worker[0]->telephone)) && | 243 | if ((!empty($Worker[0]->telephone)) && |
244 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && | 244 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && |
245 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { | 245 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { |
246 | // 40% | 246 | // 40% |
247 | $persent = $persent + 40; | 247 | $persent = $persent + 40; |
248 | $persent1 = 40; | 248 | $persent1 = 40; |
249 | } | 249 | } |
250 | 250 | ||
251 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); | 251 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); |
252 | 252 | ||
253 | if ($Worker[0]->sertificate->count() > 0) { | 253 | if ($Worker[0]->sertificate->count() > 0) { |
254 | // 15% | 254 | // 15% |
255 | $persent = $persent + 15; | 255 | $persent = $persent + 15; |
256 | $persent2 = 15; | 256 | $persent2 = 15; |
257 | } | 257 | } |
258 | 258 | ||
259 | if ($Worker[0]->infobloks->count() > 0) { | 259 | if ($Worker[0]->infobloks->count() > 0) { |
260 | // 20% | 260 | // 20% |
261 | $persent = $persent + 20; | 261 | $persent = $persent + 20; |
262 | $persent3 = 20; | 262 | $persent3 = 20; |
263 | } | 263 | } |
264 | 264 | ||
265 | if ($Worker[0]->prev_company->count() > 0) { | 265 | if ($Worker[0]->prev_company->count() > 0) { |
266 | // 10% | 266 | // 10% |
267 | $persent = $persent + 10; | 267 | $persent = $persent + 10; |
268 | $persent4 = 10; | 268 | $persent4 = 10; |
269 | } | 269 | } |
270 | 270 | ||
271 | if (!empty($Worker[0]->photo)) { | 271 | if (!empty($Worker[0]->photo)) { |
272 | // 5% | 272 | // 5% |
273 | $persent = $persent + 5; | 273 | $persent = $persent + 5; |
274 | $persent5 = 5; | 274 | $persent5 = 5; |
275 | } | 275 | } |
276 | 276 | ||
277 | //dd($persent1, $persent2, $persent3, $persent4, $persent5); | 277 | //dd($persent1, $persent2, $persent3, $persent4, $persent5); |
278 | 278 | ||
279 | if ($request->has('print')) { | 279 | if ($request->has('print')) { |
280 | dd($Worker); | 280 | dd($Worker); |
281 | } else { | 281 | } else { |
282 | return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); | 282 | return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | // Сохранение данных | 286 | // Сохранение данных |
287 | public function cabinet_save(Worker $worker, Request $request) | 287 | public function cabinet_save(Worker $worker, Request $request) |
288 | { | 288 | { |
289 | $id = $worker->id; | 289 | $id = $worker->id; |
290 | $params = $request->all(); | 290 | $params = $request->all(); |
291 | 291 | ||
292 | $job_title_id = $request->get('job_title_id'); | 292 | $job_title_id = $request->get('job_title_id'); |
293 | 293 | ||
294 | unset($params['new_diplom']); | 294 | unset($params['new_diplom']); |
295 | unset($params['new_data_begin']); | 295 | unset($params['new_data_begin']); |
296 | unset($params['new_data_end']); | 296 | unset($params['new_data_end']); |
297 | unset($params['new_job_title']); | 297 | unset($params['new_job_title']); |
298 | unset($params['new_teplohod']); | 298 | unset($params['new_teplohod']); |
299 | unset($params['new_GWT']); | 299 | unset($params['new_GWT']); |
300 | unset($params['new_KBT']); | 300 | unset($params['new_KBT']); |
301 | unset($params['new_Begin_work']); | 301 | unset($params['new_Begin_work']); |
302 | unset($params['new_End_work']); | 302 | unset($params['new_End_work']); |
303 | unset($params['new_name_company']); | 303 | unset($params['new_name_company']); |
304 | 304 | ||
305 | $rules = [ | 305 | $rules = [ |
306 | 'surname' => ['required', 'string', 'max:255'], | 306 | 'surname' => ['required', 'string', 'max:255'], |
307 | 'name_man' => ['required', 'string', 'max:255'], | 307 | 'name_man' => ['required', 'string', 'max:255'], |
308 | 'email' => ['required', 'string', 'email', 'max:255'], | 308 | 'email' => ['required', 'string', 'email', 'max:255'], |
309 | 309 | ||
310 | ]; | 310 | ]; |
311 | 311 | ||
312 | $messages = [ | 312 | $messages = [ |
313 | 'required' => 'Укажите обязательное поле', | 313 | 'required' => 'Укажите обязательное поле', |
314 | 'min' => [ | 314 | 'min' => [ |
315 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 315 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
316 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 316 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
317 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 317 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
318 | ], | 318 | ], |
319 | 'max' => [ | 319 | 'max' => [ |
320 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 320 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
321 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 321 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
322 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 322 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
323 | ] | 323 | ] |
324 | ]; | 324 | ]; |
325 | 325 | ||
326 | $validator = Validator::make($params, $rules, $messages); | 326 | $validator = Validator::make($params, $rules, $messages); |
327 | 327 | ||
328 | if ($validator->fails()) { | 328 | if ($validator->fails()) { |
329 | return redirect()->route('worker.cabinet')->withErrors($validator); | 329 | return redirect()->route('worker.cabinet')->withErrors($validator); |
330 | } else { | 330 | } else { |
331 | 331 | ||
332 | if ($request->has('photo')) { | 332 | if ($request->has('photo')) { |
333 | if (!empty($Worker->photo)) { | 333 | if (!empty($Worker->photo)) { |
334 | Storage::delete($Worker->photo); | 334 | Storage::delete($Worker->photo); |
335 | } | 335 | } |
336 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); | 336 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); |
337 | } | 337 | } |
338 | 338 | ||
339 | if ($request->has('file')) { | 339 | if ($request->has('file')) { |
340 | if (!empty($Worker->file)) { | 340 | if (!empty($Worker->file)) { |
341 | Storage::delete($Worker->file); | 341 | Storage::delete($Worker->file); |
342 | } | 342 | } |
343 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); | 343 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); |
344 | } | 344 | } |
345 | 345 | ||
346 | $id_wor = $worker->update($params); | 346 | $id_wor = $worker->update($params); |
347 | $use = User::find($worker->user_id); | 347 | $use = User::find($worker->user_id); |
348 | $use->surname = $request->get('surname'); | 348 | $use->surname = $request->get('surname'); |
349 | $use->name_man = $request->get('name_man'); | 349 | $use->name_man = $request->get('name_man'); |
350 | $use->surname2 = $request->get('surname2'); | 350 | $use->surname2 = $request->get('surname2'); |
351 | 351 | ||
352 | $use->save(); | 352 | $use->save(); |
353 | $worker->job_titles()->sync($job_title_id); | 353 | $worker->job_titles()->sync($job_title_id); |
354 | 354 | ||
355 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); | 355 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); |
356 | } | 356 | } |
357 | } | 357 | } |
358 | 358 | ||
359 | // Сообщения данные | 359 | // Сообщения данные |
360 | public function messages($type_message) | 360 | public function messages($type_message) |
361 | { | 361 | { |
362 | $user_id = Auth()->user()->id; | 362 | $user_id = Auth()->user()->id; |
363 | 363 | ||
364 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 364 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
365 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 365 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
366 | 366 | ||
367 | $messages_output = Message::query()->with('vacancies')-> | 367 | $messages_output = Message::query()->with('vacancies')-> |
368 | with('user_to')->where('user_id', $user_id)-> | 368 | with('user_to')->where('user_id', $user_id)-> |
369 | OrderByDesc('created_at'); | 369 | OrderByDesc('created_at'); |
370 | 370 | ||
371 | 371 | ||
372 | $count_input = $messages_input->count(); | 372 | $count_input = $messages_input->count(); |
373 | $count_output = $messages_output->count(); | 373 | $count_output = $messages_output->count(); |
374 | 374 | ||
375 | if ($type_message == 'input') { | 375 | if ($type_message == 'input') { |
376 | $messages = $messages_input->paginate(15); | 376 | $messages = $messages_input->paginate(5); |
377 | } | 377 | } |
378 | 378 | ||
379 | if ($type_message == 'output') { | 379 | if ($type_message == 'output') { |
380 | $messages = $messages_output->paginate(15); | 380 | $messages = $messages_output->paginate(5); |
381 | } | 381 | } |
382 | |||
382 | // Вернуть все 100% | 383 | // Вернуть все 100% |
383 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 384 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
384 | } | 385 | } |
385 | 386 | ||
386 | // Избранный | 387 | // Избранный |
387 | public function favorite() | 388 | public function favorite() |
388 | { | 389 | { |
389 | return view('workers.favorite'); | 390 | return view('workers.favorite'); |
390 | } | 391 | } |
391 | 392 | ||
392 | // Сменить пароль | 393 | // Сменить пароль |
393 | public function new_password() | 394 | public function new_password() |
394 | { | 395 | { |
395 | $email = Auth()->user()->email; | 396 | $email = Auth()->user()->email; |
396 | return view('workers.new_password', compact('email')); | 397 | return view('workers.new_password', compact('email')); |
397 | } | 398 | } |
398 | 399 | ||
399 | // Обновление пароля | 400 | // Обновление пароля |
400 | public function save_new_password(Request $request) { | 401 | public function save_new_password(Request $request) { |
401 | $use = Auth()->user(); | 402 | $use = Auth()->user(); |
402 | $request->validate([ | 403 | $request->validate([ |
403 | 'password' => 'required|string', | 404 | 'password' => 'required|string', |
404 | 'new_password' => 'required|string', | 405 | 'new_password' => 'required|string', |
405 | 'new_password2' => 'required|string' | 406 | 'new_password2' => 'required|string' |
406 | ]); | 407 | ]); |
407 | 408 | ||
408 | if ($request->get('new_password') == $request->get('new_password2')) | 409 | if ($request->get('new_password') == $request->get('new_password2')) |
409 | if ($request->get('password') !== $request->get('new_password')) { | 410 | if ($request->get('password') !== $request->get('new_password')) { |
410 | $credentials = $request->only('email', 'password'); | 411 | $credentials = $request->only('email', 'password'); |
411 | if (Auth::attempt($credentials, $request->has('save_me'))) { | 412 | if (Auth::attempt($credentials, $request->has('save_me'))) { |
412 | 413 | ||
413 | if (!is_null($use->email_verified_at)){ | 414 | if (!is_null($use->email_verified_at)){ |
414 | 415 | ||
415 | $user_data = User_Model::find($use->id); | 416 | $user_data = User_Model::find($use->id); |
416 | $user_data->update([ | 417 | $user_data->update([ |
417 | 'password' => Hash::make($request->get('new_password')), | 418 | 'password' => Hash::make($request->get('new_password')), |
418 | 'pubpassword' => base64_encode($request->get('new_password')), | 419 | 'pubpassword' => base64_encode($request->get('new_password')), |
419 | ]); | 420 | ]); |
420 | return redirect() | 421 | return redirect() |
421 | ->route('worker.new_password') | 422 | ->route('worker.new_password') |
422 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 423 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
423 | } | 424 | } |
424 | 425 | ||
425 | return redirect() | 426 | return redirect() |
426 | ->route('worker.new_password') | 427 | ->route('worker.new_password') |
427 | ->withError('Данная учетная запись не было верифицированна!'); | 428 | ->withError('Данная учетная запись не было верифицированна!'); |
428 | } | 429 | } |
429 | } | 430 | } |
430 | 431 | ||
431 | return redirect() | 432 | return redirect() |
432 | ->route('worker.new_password') | 433 | ->route('worker.new_password') |
433 | ->withErrors('Не совпадение данных, обновите пароли!'); | 434 | ->withErrors('Не совпадение данных, обновите пароли!'); |
434 | } | 435 | } |
435 | 436 | ||
436 | // Удаление профиля форма | 437 | // Удаление профиля форма |
437 | public function delete_profile() | 438 | public function delete_profile() |
438 | { | 439 | { |
439 | $login = Auth()->user()->email; | 440 | $login = Auth()->user()->email; |
440 | return view('workers.delete_profile', compact('login')); | 441 | return view('workers.delete_profile', compact('login')); |
441 | } | 442 | } |
442 | 443 | ||
443 | // Удаление профиля код | 444 | // Удаление профиля код |
444 | public function delete_profile_result(Request $request) { | 445 | public function delete_profile_result(Request $request) { |
445 | $Answer = $request->all(); | 446 | $Answer = $request->all(); |
446 | $user_id = Auth()->user()->id; | 447 | $user_id = Auth()->user()->id; |
447 | $request->validate([ | 448 | $request->validate([ |
448 | 'password' => 'required|string', | 449 | 'password' => 'required|string', |
449 | ]); | 450 | ]); |
450 | 451 | ||
451 | $credentials = $request->only('email', 'password'); | 452 | $credentials = $request->only('email', 'password'); |
452 | if (Auth::attempt($credentials)) { | 453 | if (Auth::attempt($credentials)) { |
453 | Auth::logout(); | 454 | Auth::logout(); |
454 | $it = User_Model::find($user_id); | 455 | $it = User_Model::find($user_id); |
455 | $it->delete(); | 456 | $it->delete(); |
456 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 457 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
457 | } else { | 458 | } else { |
458 | return redirect()->route('worker.delete_profile') | 459 | return redirect()->route('worker.delete_profile') |
459 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 460 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
460 | } | 461 | } |
461 | } | 462 | } |
462 | 463 | ||
463 | // Регистрация соискателя | 464 | // Регистрация соискателя |
464 | public function register_worker(Request $request) | 465 | public function register_worker(Request $request) |
465 | { | 466 | { |
466 | $params = $request->all(); | 467 | $params = $request->all(); |
467 | $params['is_worker'] = 1; | 468 | $params['is_worker'] = 1; |
468 | 469 | ||
469 | $rules = [ | 470 | $rules = [ |
470 | 'surname' => ['required', 'string', 'max:255'], | 471 | 'surname' => ['required', 'string', 'max:255'], |
471 | 'name_man' => ['required', 'string', 'max:255'], | 472 | 'name_man' => ['required', 'string', 'max:255'], |
472 | 'email' => ['required', 'email', 'max:255', 'unique:users'], | 473 | 'email' => ['required', 'email', 'max:255', 'unique:users'], |
473 | 'password' => ['required', 'string', 'min:8'] | 474 | 'password' => ['required', 'string', 'min:8'] |
474 | ]; | 475 | ]; |
475 | 476 | ||
476 | $messages = [ | 477 | $messages = [ |
477 | 'required' => 'Укажите обязательное поле', | 478 | 'required' => 'Укажите обязательное поле', |
478 | 'min' => [ | 479 | 'min' => [ |
479 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 480 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
480 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 481 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
481 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 482 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
482 | ], | 483 | ], |
483 | 'max' => [ | 484 | 'max' => [ |
484 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 485 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
485 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 486 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
486 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 487 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
487 | ] | 488 | ] |
488 | ]; | 489 | ]; |
489 | 490 | ||
490 | $email = $request->get('email'); | 491 | $email = $request->get('email'); |
491 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 492 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
492 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 493 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
493 | } | 494 | } |
494 | 495 | ||
495 | if ($request->get('password') !== $request->get('confirmed')){ | 496 | if ($request->get('password') !== $request->get('confirmed')){ |
496 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 497 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
497 | } | 498 | } |
498 | 499 | ||
499 | $haystack = $request->get('password'); | 500 | $haystack = $request->get('password'); |
500 | 501 | ||
501 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 502 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
502 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 503 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
503 | 'X', 'C', 'V', 'B', 'N', 'M'); | 504 | 'X', 'C', 'V', 'B', 'N', 'M'); |
504 | $lenpwd_bool = true; | 505 | $lenpwd_bool = true; |
505 | $spec_bool = false; | 506 | $spec_bool = false; |
506 | $alpha_bool = false; | 507 | $alpha_bool = false; |
507 | 508 | ||
508 | if (strlen($haystack) < 8) $lenpwd_bool = false; | 509 | if (strlen($haystack) < 8) $lenpwd_bool = false; |
509 | 510 | ||
510 | foreach ($specsumbol as $it) { | 511 | foreach ($specsumbol as $it) { |
511 | if (strpos($haystack, $it) !== false) { | 512 | if (strpos($haystack, $it) !== false) { |
512 | $spec_bool = true; | 513 | $spec_bool = true; |
513 | } | 514 | } |
514 | } | 515 | } |
515 | 516 | ||
516 | foreach ($alpha as $it) { | 517 | foreach ($alpha as $it) { |
517 | if (strpos($haystack, $it) !== false) { | 518 | if (strpos($haystack, $it) !== false) { |
518 | $alpha_bool = true; | 519 | $alpha_bool = true; |
519 | } | 520 | } |
520 | } | 521 | } |
521 | 522 | ||
522 | if (!$lenpwd_bool) { | 523 | if (!$lenpwd_bool) { |
523 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 524 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
524 | } | 525 | } |
525 | 526 | ||
526 | if ((!$spec_bool) || (!$alpha_bool)) { | 527 | if ((!$spec_bool) || (!$alpha_bool)) { |
527 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 528 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
528 | } | 529 | } |
529 | 530 | ||
530 | if (($request->has('politik')) && ($request->get('politik') == 1)) { | 531 | if (($request->has('politik')) && ($request->get('politik') == 1)) { |
531 | $validator = Validator::make($params, $rules, $messages); | 532 | $validator = Validator::make($params, $rules, $messages); |
532 | 533 | ||
533 | if ($validator->fails()) { | 534 | if ($validator->fails()) { |
534 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 535 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
535 | } else { | 536 | } else { |
536 | //dd($params); | 537 | //dd($params); |
537 | $user = $this->create($params); | 538 | $user = $this->create($params); |
538 | event(new Registered($user)); | 539 | event(new Registered($user)); |
539 | Auth::guard()->login($user); | 540 | Auth::guard()->login($user); |
540 | } | 541 | } |
541 | if ($user) { | 542 | if ($user) { |
542 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; | 543 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; |
543 | } else { | 544 | } else { |
544 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 545 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
545 | } | 546 | } |
546 | 547 | ||
547 | } else { | 548 | } else { |
548 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); | 549 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); |
549 | } | 550 | } |
550 | } | 551 | } |
551 | 552 | ||
552 | // Звездная оценка и ответ | 553 | // Звездная оценка и ответ |
553 | public function stars_answer(Request $request) { | 554 | public function stars_answer(Request $request) { |
554 | $params = $request->all(); | 555 | $params = $request->all(); |
555 | $rules = [ | 556 | $rules = [ |
556 | 'message' => ['required', 'string', 'max:255'], | 557 | 'message' => ['required', 'string', 'max:255'], |
557 | ]; | 558 | ]; |
558 | 559 | ||
559 | $messages = [ | 560 | $messages = [ |
560 | 'required' => 'Укажите обязательное поле', | 561 | 'required' => 'Укажите обязательное поле', |
561 | 'min' => [ | 562 | 'min' => [ |
562 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 563 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
563 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 564 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
564 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 565 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
565 | ], | 566 | ], |
566 | 'max' => [ | 567 | 'max' => [ |
567 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 568 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
568 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 569 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
569 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 570 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
570 | ] | 571 | ] |
571 | ]; | 572 | ]; |
572 | $response_worker = ResponseWork::create($params); | 573 | $response_worker = ResponseWork::create($params); |
573 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); | 574 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); |
574 | } | 575 | } |
575 | 576 | ||
576 | public function TestWorker() | 577 | public function TestWorker() |
577 | { | 578 | { |
578 | $Use = new User(); | 579 | $Use = new User(); |
579 | 580 | ||
580 | $Code_user = $Use->create([ | 581 | $Code_user = $Use->create([ |
581 | 'name' => 'surname name_man', | 582 | 'name' => 'surname name_man', |
582 | 'name_man' => 'name_man', | 583 | 'name_man' => 'name_man', |
583 | 'surname' => 'surname', | 584 | 'surname' => 'surname', |
584 | 'surname2' => 'surname2', | 585 | 'surname2' => 'surname2', |
585 | 'subscribe_email' => '1', | 586 | 'subscribe_email' => '1', |
586 | 'email' => 'email@mail.com', | 587 | 'email' => 'email@mail.com', |
587 | 'telephone' => '1234567890', | 588 | 'telephone' => '1234567890', |
588 | 'password' => Hash::make('password'), | 589 | 'password' => Hash::make('password'), |
589 | 'pubpassword' => base64_encode('password'), | 590 | 'pubpassword' => base64_encode('password'), |
590 | 'email_verified_at' => Carbon::now(), | 591 | 'email_verified_at' => Carbon::now(), |
591 | 'is_worker' => 1, | 592 | 'is_worker' => 1, |
592 | ]); | 593 | ]); |
593 | 594 | ||
594 | if ($Code_user->id > 0) { | 595 | if ($Code_user->id > 0) { |
595 | $Worker = new Worker(); | 596 | $Worker = new Worker(); |
596 | $Worker->user_id = $Code_user->id; | 597 | $Worker->user_id = $Code_user->id; |
597 | $Worker->position_work = 1; //'job_titles'; | 598 | $Worker->position_work = 1; //'job_titles'; |
598 | $Worker->email = 'email@email.com'; | 599 | $Worker->email = 'email@email.com'; |
599 | $Worker->telephone = '1234567890'; | 600 | $Worker->telephone = '1234567890'; |
600 | $status = $Worker->save(); | 601 | $status = $Worker->save(); |
601 | 602 | ||
602 | $Title_Worker = new Title_worker(); | 603 | $Title_Worker = new Title_worker(); |
603 | $Title_Worker->worker_id = $Worker->id; | 604 | $Title_Worker->worker_id = $Worker->id; |
604 | $Title_Worker->job_title_id = 1; | 605 | $Title_Worker->job_title_id = 1; |
605 | $Title_Worker->save(); | 606 | $Title_Worker->save(); |
606 | } | 607 | } |
607 | } | 608 | } |
608 | 609 | ||
609 | // Создание пользователя | 610 | // Создание пользователя |
610 | protected function create(array $data) | 611 | protected function create(array $data) |
611 | { | 612 | { |
612 | $Use = new User(); | 613 | $Use = new User(); |
613 | 614 | ||
614 | $Code_user = $Use->create([ | 615 | $Code_user = $Use->create([ |
615 | 'name' => $data['surname']." ".$data['name_man'], | 616 | 'name' => $data['surname']." ".$data['name_man'], |
616 | 'name_man' => $data['name_man'], | 617 | 'name_man' => $data['name_man'], |
617 | 'surname' => $data['surname'], | 618 | 'surname' => $data['surname'], |
618 | 'surname2' => $data['surname2'], | 619 | 'surname2' => $data['surname2'], |
619 | 'subscribe_email' => $data['email'], | 620 | 'subscribe_email' => $data['email'], |
620 | 'email' => $data['email'], | 621 | 'email' => $data['email'], |
621 | 'telephone' => $data['telephone'], | 622 | 'telephone' => $data['telephone'], |
622 | 'password' => Hash::make($data['password']), | 623 | 'password' => Hash::make($data['password']), |
623 | 'pubpassword' => base64_encode($data['password']), | 624 | 'pubpassword' => base64_encode($data['password']), |
624 | 'email_verified_at' => Carbon::now(), | 625 | 'email_verified_at' => Carbon::now(), |
625 | 'is_worker' => $data['is_worker'], | 626 | 'is_worker' => $data['is_worker'], |
626 | ]); | 627 | ]); |
627 | 628 | ||
628 | if ($Code_user->id > 0) { | 629 | if ($Code_user->id > 0) { |
629 | $Worker = new Worker(); | 630 | $Worker = new Worker(); |
630 | $Worker->user_id = $Code_user->id; | 631 | $Worker->user_id = $Code_user->id; |
631 | $Worker->position_work = $data['job_titles']; | 632 | $Worker->position_work = $data['job_titles']; |
632 | $Worker->email = $data['email']; | 633 | $Worker->email = $data['email']; |
633 | $Worker->telephone = $data['telephone']; | 634 | $Worker->telephone = $data['telephone']; |
634 | $Worker->save(); | 635 | $Worker->save(); |
635 | 636 | ||
636 | if (isset($Worker->id)) { | 637 | if (isset($Worker->id)) { |
637 | $Title_Worker = new Title_worker(); | 638 | $Title_Worker = new Title_worker(); |
638 | $Title_Worker->worker_id = $Worker->id; | 639 | $Title_Worker->worker_id = $Worker->id; |
639 | $Title_Worker->job_title_id = $data['job_titles']; | 640 | $Title_Worker->job_title_id = $data['job_titles']; |
640 | $Title_Worker->save(); | 641 | $Title_Worker->save(); |
641 | } | 642 | } |
642 | 643 | ||
643 | return $Code_user; | 644 | return $Code_user; |
644 | } | 645 | } |
645 | } | 646 | } |
646 | 647 | ||
647 | // Вакансии избранные | 648 | // Вакансии избранные |
648 | public function colorado(Request $request) { | 649 | public function colorado(Request $request) { |
649 | $IP_address = RusDate::ip_addr_client(); | 650 | $IP_address = RusDate::ip_addr_client(); |
650 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 651 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
651 | 652 | ||
652 | if ($Arr->count()) { | 653 | if ($Arr->count()) { |
653 | $A = Array(); | 654 | $A = Array(); |
654 | foreach ($Arr as $it) { | 655 | foreach ($Arr as $it) { |
655 | $A[] = $it->code_record; | 656 | $A[] = $it->code_record; |
656 | } | 657 | } |
657 | 658 | ||
658 | $Query = Ad_employer::query()->whereIn('id', $A); | 659 | $Query = Ad_employer::query()->whereIn('id', $A); |
659 | } else { | 660 | } else { |
660 | $Query = Ad_employer::query()->where('id', '=', '0'); | 661 | $Query = Ad_employer::query()->where('id', '=', '0'); |
661 | } | 662 | } |
662 | 663 | ||
663 | $Query = $Query->with('jobs')-> | 664 | $Query = $Query->with('jobs')-> |
664 | with('cat')-> | 665 | with('cat')-> |
665 | with('employer')-> | 666 | with('employer')-> |
666 | whereHas('jobs_code', function ($query) use ($request) { | 667 | whereHas('jobs_code', function ($query) use ($request) { |
667 | if ($request->ajax()) { | 668 | if ($request->ajax()) { |
668 | if (null !== ($request->get('job'))) { | 669 | if (null !== ($request->get('job'))) { |
669 | $query->where('job_title_id', $request->get('job')); | 670 | $query->where('job_title_id', $request->get('job')); |
670 | } | 671 | } |
671 | } | 672 | } |
672 | })->select('ad_employers.*'); | 673 | })->select('ad_employers.*'); |
673 | 674 | ||
674 | $Job_title = Job_title::query()->OrderBy('name')->get(); | 675 | $Job_title = Job_title::query()->OrderBy('name')->get(); |
675 | 676 | ||
676 | $Query_count = $Query->count(); | 677 | $Query_count = $Query->count(); |
677 | 678 | ||
678 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 679 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
679 | 680 | ||
680 | return view('workers.favorite', compact('Query', | 681 | return view('workers.favorite', compact('Query', |
681 | 'Query_count', | 682 | 'Query_count', |
682 | 'Job_title')); | 683 | 'Job_title')); |
683 | 684 | ||
684 | } | 685 | } |
685 | 686 | ||
686 | //Переписка | 687 | //Переписка |
687 | public function dialog(User_Model $user1, User_Model $user2) { | 688 | public function dialog(User_Model $user1, User_Model $user2) { |
688 | if (isset($user2->id)) { | 689 | if (isset($user2->id)) { |
689 | $companion = User_Model::query()->with('workers')-> | 690 | $companion = User_Model::query()->with('workers')-> |
690 | with('employers')-> | 691 | with('employers')-> |
691 | where('id', $user2->id)->first(); | 692 | where('id', $user2->id)->first(); |
692 | } | 693 | } |
693 | 694 | ||
694 | $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { | 695 | $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { |
695 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 696 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
696 | })->orWhere(function($query) use ($user1, $user2) { | 697 | })->orWhere(function($query) use ($user1, $user2) { |
697 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 698 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
698 | })->OrderBy('created_at')->get(); | 699 | })->OrderBy('created_at')->get(); |
699 | 700 | ||
700 | $id_vac = null; | 701 | $id_vac = null; |
701 | foreach ($Messages as $it) { | 702 | foreach ($Messages as $it) { |
702 | if (isset($it->response)) { | 703 | if (isset($it->response)) { |
703 | foreach ($it->response as $r) { | 704 | foreach ($it->response as $r) { |
704 | if (isset($r->ad_employer_id)) { | 705 | if (isset($r->ad_employer_id)) { |
705 | $id_vac = $r->ad_employer_id; | 706 | $id_vac = $r->ad_employer_id; |
706 | break; | 707 | break; |
707 | } | 708 | } |
708 | } | 709 | } |
709 | } | 710 | } |
710 | if (!is_null($id_vac)) break; | 711 | if (!is_null($id_vac)) break; |
711 | } | 712 | } |
712 | 713 | ||
713 | $ad_employer = null; | 714 | $ad_employer = null; |
714 | if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 715 | if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
715 | $sender = $user1; | 716 | $sender = $user1; |
716 | 717 | ||
717 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); | 718 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); |
718 | } | 719 | } |
719 | 720 | ||
720 | // Даунылоады | 721 | // Даунылоады |
721 | public function download(Worker $worker) { | 722 | public function download(Worker $worker) { |
722 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; | 723 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; |
723 | view()->share('house',$arr_house); | 724 | view()->share('house',$arr_house); |
724 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); | 725 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); |
725 | return $pdf->stream(); | 726 | return $pdf->stream(); |
726 | } | 727 | } |
727 | 728 | ||
728 | // Поднятие анкеты | 729 | // Поднятие анкеты |
729 | public function up(Worker $worker) { | 730 | public function up(Worker $worker) { |
730 | $worker->updated_at = Carbon::now(); | 731 | $worker->updated_at = Carbon::now(); |
731 | $worker->save(); | 732 | $worker->save(); |
732 | // 0 | 733 | // 0 |
733 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); | 734 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); |
734 | } | 735 | } |
735 | 736 | ||
736 | // Форма сертификате | 737 | // Форма сертификате |
737 | public function new_sertificate(Worker $worker) { | 738 | public function new_sertificate(Worker $worker) { |
738 | return view('workers.sertificate_add', compact('worker')); | 739 | return view('workers.sertificate_add', compact('worker')); |
739 | } | 740 | } |
740 | 741 | ||
741 | // Добавление сертификата | 742 | // Добавление сертификата |
742 | public function add_serificate(SertificationRequest $request) { | 743 | public function add_serificate(SertificationRequest $request) { |
743 | $params = $request->all(); | 744 | $params = $request->all(); |
744 | 745 | ||
745 | $Sertificate = new sertification(); | 746 | $Sertificate = new sertification(); |
746 | $Sertificate->create($params); | 747 | $Sertificate->create($params); |
747 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); | 748 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); |
748 | return redirect()->route('worker.cabinet'); | 749 | return redirect()->route('worker.cabinet'); |
749 | //return view('ajax.documents', compact('Docs')); | 750 | //return view('ajax.documents', compact('Docs')); |
750 | } | 751 | } |
751 | 752 | ||
752 | // Удалить сертификат | 753 | // Удалить сертификат |
753 | public function delete_sertificate(sertification $doc) { | 754 | public function delete_sertificate(sertification $doc) { |
754 | $doc->delete(); | 755 | $doc->delete(); |
755 | 756 | ||
756 | return redirect()->route('worker.cabinet'); | 757 | return redirect()->route('worker.cabinet'); |
757 | } | 758 | } |
758 | 759 | ||
759 | // Редактирование сертификата | 760 | // Редактирование сертификата |
760 | public function edit_sertificate(Worker $worker, sertification $doc) { | 761 | public function edit_sertificate(Worker $worker, sertification $doc) { |
761 | return view('workers.sertificate_edit', compact('doc', 'worker')); | 762 | return view('workers.sertificate_edit', compact('doc', 'worker')); |
762 | } | 763 | } |
763 | 764 | ||
764 | // Редактирование обновление сертификата | 765 | // Редактирование обновление сертификата |
765 | public function update_serificate(SertificationRequest $request, sertification $doc) { | 766 | public function update_serificate(SertificationRequest $request, sertification $doc) { |
766 | $all = $request->all(); | 767 | $all = $request->all(); |
767 | $doc->worker_id = $all['worker_id']; | 768 | $doc->worker_id = $all['worker_id']; |
768 | $doc->name = $all['name']; | 769 | $doc->name = $all['name']; |
769 | $doc->end_begin = $all['end_begin']; | 770 | $doc->end_begin = $all['end_begin']; |
770 | $doc->save(); | 771 | $doc->save(); |
771 | 772 | ||
772 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 773 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
773 | } | 774 | } |
774 | 775 | ||
775 | public function delete_add_diplom(Request $request, Worker $worker) { | 776 | public function delete_add_diplom(Request $request, Worker $worker) { |
776 | $infoblok_id = $request->get('infoblok_id'); | 777 | $infoblok_id = $request->get('infoblok_id'); |
777 | 778 | ||
778 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) | 779 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) |
779 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); | 780 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); |
780 | else { | 781 | else { |
781 | $params['infoblok_id'] = $infoblok_id; | 782 | $params['infoblok_id'] = $infoblok_id; |
782 | $params['worker_id'] = $worker->id; | 783 | $params['worker_id'] = $worker->id; |
783 | $id = Dop_info::create($params); | 784 | $id = Dop_info::create($params); |
784 | //$id = $worker->infobloks()->sync([$infoblok_id]); | 785 | //$id = $worker->infobloks()->sync([$infoblok_id]); |
785 | } | 786 | } |
786 | 787 | ||
787 | //$Infoblocks = infobloks::query()->get(); | 788 | //$Infoblocks = infobloks::query()->get(); |
788 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); | 789 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); |
789 | } | 790 | } |
790 | 791 | ||
791 | 792 | ||
792 | 793 | ||
793 | // Добавление диплома | 794 | // Добавление диплома |
794 | public function add_diplom_ajax(Request $request) { | 795 | public function add_diplom_ajax(Request $request) { |
795 | // конец | 796 | // конец |
796 | $params = $request->all(); | 797 | $params = $request->all(); |
797 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 798 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
798 | 799 | ||
799 | if ($count == 0) $dop_info = Dop_info::create($params); | 800 | if ($count == 0) $dop_info = Dop_info::create($params); |
800 | $Infoblocks = infobloks::query()->get(); | 801 | $Infoblocks = infobloks::query()->get(); |
801 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); | 802 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); |
802 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); | 803 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); |
803 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); | 804 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); |
804 | } | 805 | } |
805 | 806 | ||
806 | // Добавление диплома без ajax | 807 | // Добавление диплома без ajax |
807 | public function add_diplom(Worker $worker) { | 808 | public function add_diplom(Worker $worker) { |
808 | $worker_id = $worker->id; | 809 | $worker_id = $worker->id; |
809 | $Infoblocks = infobloks::query()->get(); | 810 | $Infoblocks = infobloks::query()->get(); |
810 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); | 811 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); |
811 | } | 812 | } |
812 | // Сохранить | 813 | // Сохранить |
813 | // Сохраняю диплом | 814 | // Сохраняю диплом |
814 | public function add_diplom_save(Request $request) { | 815 | public function add_diplom_save(Request $request) { |
815 | $params = $request->all(); | 816 | $params = $request->all(); |
816 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 817 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
817 | if ($count == 0) $dop_info = Dop_info::create($params); | 818 | if ($count == 0) $dop_info = Dop_info::create($params); |
818 | return redirect()->route('worker.cabinet'); | 819 | return redirect()->route('worker.cabinet'); |
819 | } | 820 | } |
820 | 821 | ||
821 | // Добавление стандартного документа | 822 | // Добавление стандартного документа |
822 | public function add_document(Worker $worker) { | 823 | public function add_document(Worker $worker) { |
823 | return view('workers.docs', compact('worker')); | 824 | return view('workers.docs', compact('worker')); |
824 | } | 825 | } |
825 | 826 | ||
826 | //Сохранение стандартого документа | 827 | //Сохранение стандартого документа |
827 | public function add_document_save(DocumentsRequest $request) { | 828 | public function add_document_save(DocumentsRequest $request) { |
828 | $params = $request->all(); | 829 | $params = $request->all(); |
829 | $place_work = place_works::create($params); | 830 | $place_work = place_works::create($params); |
830 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); | 831 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); |
831 | } | 832 | } |
832 | 833 | ||
833 | // Редактирование документа | 834 | // Редактирование документа |
834 | public function edit_document(place_works $doc, Worker $worker) { | 835 | public function edit_document(place_works $doc, Worker $worker) { |
835 | return view('workers.docs-edit', compact('doc', 'worker')); | 836 | return view('workers.docs-edit', compact('doc', 'worker')); |
836 | } | 837 | } |
837 | 838 | ||
838 | //Сохранение отредактированного документа | 839 | //Сохранение отредактированного документа |
839 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { | 840 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { |
840 | $params = $request->all(); | 841 | $params = $request->all(); |
841 | $doc->update($params); | 842 | $doc->update($params); |
842 | 843 | ||
843 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 844 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
844 | } | 845 | } |
845 | 846 | ||
846 | // Удаление документа | 847 | // Удаление документа |
847 | public function delete_document(place_works $doc) { | 848 | public function delete_document(place_works $doc) { |
848 | $doc->delete(); | 849 | $doc->delete(); |
849 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 850 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
850 | } | 851 | } |
851 | 852 | ||
852 | //Отправка нового сообщения | 853 | //Отправка нового сообщения |
853 | public function new_message(Request $request) { | 854 | public function new_message(Request $request) { |
854 | $params = $request->all(); | 855 | $params = $request->all(); |
855 | 856 | ||
856 | $id = $params['send_user_id']; | 857 | $id = $params['send_user_id']; |
857 | $message = new Message(); | 858 | $message = new Message(); |
858 | $message->user_id = $params['send_user_id']; | 859 | $message->user_id = $params['send_user_id']; |
859 | $message->to_user_id = $params['send_to_user_id']; | 860 | $message->to_user_id = $params['send_to_user_id']; |
860 | $message->title = $params['send_title']; | 861 | $message->title = $params['send_title']; |
861 | $message->text = $params['send_text']; | 862 | $message->text = $params['send_text']; |
862 | if ($request->has('send_file')) { | 863 | if ($request->has('send_file')) { |
863 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); | 864 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); |
864 | } | 865 | } |
865 | $message->flag_new = 1; | 866 | $message->flag_new = 1; |
866 | $id_message = $message->save(); | 867 | $id_message = $message->save(); |
867 | 868 | ||
868 | $data['message_id'] = $id_message; | 869 | $data['message_id'] = $id_message; |
869 | $data['ad_employer_id'] = $params['send_vacancy']; | 870 | $data['ad_employer_id'] = $params['send_vacancy']; |
870 | $data['job_title_id'] = $params['send_job_title_id']; | 871 | $data['job_title_id'] = $params['send_job_title_id']; |
871 | $data['flag'] = 1; | 872 | $data['flag'] = 1; |
872 | $ad_responce = ad_response::create($data); | 873 | $ad_responce = ad_response::create($data); |
873 | return redirect()->route('worker.messages', ['type_message' => 'output']); | 874 | return redirect()->route('worker.messages', ['type_message' => 'output']); |
874 | } | 875 | } |
875 | 876 | ||
876 | // Информация о предыдущих компаниях | 877 | // Информация о предыдущих компаниях |
877 | public function new_prev_company(Worker $worker) { | 878 | public function new_prev_company(Worker $worker) { |
878 | return view('workers.prev_company_form', compact('worker')); | 879 | return view('workers.prev_company_form', compact('worker')); |
879 | } | 880 | } |
880 | 881 | ||
881 | // Добавление контакта компании | 882 | // Добавление контакта компании |
882 | public function add_prev_company(PrevCompanyRequest $request) { | 883 | public function add_prev_company(PrevCompanyRequest $request) { |
883 | // Возвращение параметров | 884 | // Возвращение параметров |
884 | $all = $request->all(); | 885 | $all = $request->all(); |
885 | $PrevCompany = PrevCompany::create($all); | 886 | $PrevCompany = PrevCompany::create($all); |
886 | 887 | ||
887 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 888 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
888 | } | 889 | } |
889 | 890 | ||
890 | // Удаление контакта предыдущей компании | 891 | // Удаление контакта предыдущей компании |
891 | public function delete_prev_company(PrevCompany $doc) { | 892 | public function delete_prev_company(PrevCompany $doc) { |
892 | $doc->delete(); | 893 | $doc->delete(); |
893 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 894 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
894 | } | 895 | } |
895 | } | 896 | } |
896 | 897 | ||
897 | 898 |
app/Http/Requests/BaseUser_min_Request.php
File was created | 1 | <?php | |
2 | |||
3 | namespace App\Http\Requests; | ||
4 | |||
5 | use Illuminate\Foundation\Http\FormRequest; | ||
6 | |||
7 | class BaseUser_min_Request extends FormRequest | ||
8 | { | ||
9 | /** | ||
10 | * Determine if the user is authorized to make this request. | ||
11 | * | ||
12 | * @return bool | ||
13 | */ | ||
14 | public function authorize() | ||
15 | { | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | /** | ||
20 | * Get the validation rules that apply to the request. | ||
21 | * | ||
22 | * @return array<string, mixed> | ||
23 | */ | ||
24 | public function rules() | ||
25 | { | ||
26 | return [ | ||
27 | //'name' => 'required|min:3|max:255', | ||
28 | 'surname' => 'required|min:3|max:255', | ||
29 | 'name_man' => 'required|min:3|max:255', | ||
30 | ]; | ||
31 | } | ||
32 | |||
33 | public function messages() { | ||
34 | return [ | ||
35 | 'required' => 'Поле :attribute обязательно для ввода', | ||
36 | 'min' => [ | ||
37 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | ||
38 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | ||
39 | ], | ||
40 | 'max' => [ | ||
41 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | ||
42 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | ||
43 | ], | ||
44 | 'email' => 'Введите корректный емайл', | ||
45 | 'unique' => 'Емайл должен быть уникальным', | ||
46 | |||
47 | ]; | ||
48 | } | ||
49 | } | ||
50 |
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 | 7 | ||
8 | class Message extends Model | 8 | class Message extends Model |
9 | { | 9 | { |
10 | use HasFactory; | 10 | use HasFactory; |
11 | 11 | ||
12 | protected $fillable = [ | 12 | protected $fillable = [ |
13 | 'user_id', | 13 | 'user_id', |
14 | 'to_user_id', | 14 | 'to_user_id', |
15 | 'text', | 15 | 'text', |
16 | 'file', | 16 | 'file', |
17 | 'flag_new', | 17 | 'flag_new', |
18 | 'ad_employer_id', | 18 | 'ad_employer_id', |
19 | 'job_title_id' | 19 | 'job_title_id' |
20 | ]; | 20 | ]; |
21 | 21 | ||
22 | 22 | ||
23 | /* | 23 | /* |
24 | * Связь таблицы Message с таблицей User (Отправитель) | 24 | * Связь таблицы Message с таблицей User (Отправитель) |
25 | */ | 25 | */ |
26 | public function user_from() { | 26 | public function user_from() { |
27 | return $this->belongsTo(User::class, 'user_id'); | 27 | return $this->belongsTo(User::class, 'user_id'); |
28 | } | 28 | } |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * Связь таблицы Message с таблицей User (Получатель) | 31 | * Связь таблицы Message с таблицей User (Получатель) |
32 | */ | 32 | */ |
33 | public function user_to() { | 33 | public function user_to() { |
34 | return $this->belongsTo(User::class, 'to_user_id'); | 34 | return $this->belongsTo(User::class, 'to_user_id'); |
35 | } | 35 | } |
36 | 36 | ||
37 | /* | ||
38 | * Связь модели Сообщения (Message) с моделью Отклик на Вакансию (Ad_response) | ||
39 | */ | ||
40 | public function response() { | ||
41 | return $this->hasMany(ad_response::class); | ||
42 | } | ||
43 | |||
44 | // Связь модели Сообщения (Message) с моделью Вакансии (Ad_employer) | 37 | // Связь модели Сообщения (Message) с моделью Вакансии (Ad_employer) |
45 | public function vacancies() { | 38 | public function vacancies() { |
46 | return $this->belongsToMany(Ad_employer::class, 'ad_responses'); | 39 | return $this->belongsTo(Ad_employer::class, 'ad_employer_id', 'id'); |
47 | } | 40 | } |
48 | } | 41 | } |
49 | 42 |
database/migrations/2024_04_17_060549_alter_table_messages.php
File was created | 1 | <?php | |
2 | |||
3 | use Illuminate\Database\Migrations\Migration; | ||
4 | use Illuminate\Database\Schema\Blueprint; | ||
5 | use Illuminate\Support\Facades\Schema; | ||
6 | |||
7 | return new class extends Migration | ||
8 | { | ||
9 | /** | ||
10 | * Run the migrations. | ||
11 | * | ||
12 | * @return void | ||
13 | */ | ||
14 | public function up() | ||
15 | { | ||
16 | Schema::table('messages', function (Blueprint $table) { | ||
17 | $table->integer('flag_new_from')->default(1); | ||
18 | }); | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * Reverse the migrations. | ||
23 | * | ||
24 | * @return void | ||
25 | */ | ||
26 | public function down() | ||
27 | { | ||
28 | Schema::table('messages', function (Blueprint $table) { | ||
29 | $table->dropColumn('flag_new_from'); | ||
30 | }); | ||
31 | } | ||
32 | }; | ||
33 |
resources/views/employers/cabinet45.blade.php
1 | @extends('layout.frontend', ['title' => 'Кабинет работодателя - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Кабинет работодателя - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script src="https://cdn.ckeditor.com/ckeditor5/23.0.0/classic/ckeditor.js"></script> | 4 | <script src="https://cdn.ckeditor.com/ckeditor5/23.0.0/classic/ckeditor.js"></script> |
5 | <script> | 5 | <script> |
6 | ClassicEditor | 6 | ClassicEditor |
7 | .create( document.querySelector( '#text' ) ) | 7 | .create( document.querySelector( '#text' ) ) |
8 | .catch( error => { | 8 | .catch( error => { |
9 | console.error( error ); | 9 | console.error( error ); |
10 | } ); | 10 | } ); |
11 | </script> | 11 | </script> |
12 | @endsection | 12 | @endsection |
13 | @section('content') | 13 | @section('content') |
14 | <section class="cabinet"> | 14 | <section class="cabinet"> |
15 | <div class="container"> | 15 | <div class="container"> |
16 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 16 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
17 | <li><a href="{{ route('index') }}">Главная</a></li> | 17 | <li><a href="{{ route('index') }}">Главная</a></li> |
18 | <li><b>Личный кабинет</b></li> | 18 | <li><b>Личный кабинет</b></li> |
19 | </ul> | 19 | </ul> |
20 | <div class="cabinet__wrapper"> | 20 | <div class="cabinet__wrapper"> |
21 | <div class="cabinet__side"> | 21 | <div class="cabinet__side"> |
22 | <div class="cabinet__side-toper"> | 22 | <div class="cabinet__side-toper"> |
23 | @include('employers.emblema') | 23 | @include('employers.emblema') |
24 | </div> | 24 | </div> |
25 | 25 | ||
26 | @include('employers.menu', ['item' => 1]) | 26 | @include('employers.menu', ['item' => 1]) |
27 | 27 | ||
28 | </div> | 28 | </div> |
29 | <div class="cabinet__body"> | 29 | <div class="cabinet__body"> |
30 | @include('messages_error') | 30 | @include('messages_error') |
31 | 31 | ||
32 | <form action="{{ route('employer.cabinet_save', ['Employer' => $Employer[0]->id]) }}" method="POST" enctype="multipart/form-data"> | 32 | <form action="{{ route('employer.cabinet_save', ['Employer' => $Employer[0]->id]) }}" method="POST" enctype="multipart/form-data"> |
33 | @csrf | 33 | @csrf |
34 | <div class="cabinet__body-item"> | 34 | <div class="cabinet__body-item"> |
35 | <div class="cabinet__descr"> | 35 | <div class="cabinet__descr"> |
36 | <h2 class="title cabinet__title">Мой профиль</h2> | 36 | <h2 class="title cabinet__title">Мой профиль</h2> |
37 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> | 37 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> |
38 | </div> | 38 | </div> |
39 | <div class="cabinet__avatar"> | 39 | <div class="cabinet__avatar"> |
40 | <div class="cabinet__avatar-pic"> | 40 | <div class="cabinet__avatar-pic"> |
41 | @if (!empty($Employer[0]->logo)) | 41 | @if (!empty($Employer[0]->logo)) |
42 | <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}"> | 42 | <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}"> |
43 | @else | 43 | @else |
44 | <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/> | 44 | <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/> |
45 | @endif | 45 | @endif |
46 | </div> | 46 | </div> |
47 | <div class="cabinet__avatar-form"> | 47 | <div class="cabinet__avatar-form"> |
48 | <label class="file"> | 48 | <label class="file"> |
49 | <span class="file__input"> | 49 | <span class="file__input"> |
50 | <input type="file" name="logo"> | 50 | <input type="file" name="logo"> |
51 | <span class="button"> | 51 | <span class="button"> |
52 | <svg> | 52 | <svg> |
53 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> | 53 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> |
54 | </svg> | 54 | </svg> |
55 | Загрузить | 55 | Загрузить |
56 | </span> | 56 | </span> |
57 | </span> | 57 | </span> |
58 | </label> | 58 | </label> |
59 | <p class="cabinet__text">Загрузите логотип в формате .svg, .jpg, .png или .jpeg</p> | 59 | <p class="cabinet__text">Загрузите логотип в формате .svg, .jpg, .png или .jpeg</p> |
60 | </div> | 60 | </div> |
61 | </div> | 61 | </div> |
62 | <div class="cabinet__inputs"> | 62 | <div class="cabinet__inputs"> |
63 | <div class="cabinet__inputs-item form-group"> | 63 | <div class="cabinet__inputs-item form-group"> |
64 | <label class="form-group__label">Название судоходной компании</label> | 64 | <label class="form-group__label">Название судоходной компании</label> |
65 | <div class="form-group__item"> | 65 | <div class="form-group__item"> |
66 | <input type="text" class="input" name="name_company" id="name_company" placeholder="ООО Река Море" value="{{ old('name_company') ?? $Employer[0]->name_company ?? '' }}" required> | 66 | <input type="text" class="input" name="name_company" id="name_company" placeholder="ООО Река Море" value="{{ old('name_company') ?? $Employer[0]->name_company ?? '' }}" required> |
67 | @error('name_company') | 67 | @error('name_company') |
68 | <span class="text-xs text-red-600"> | 68 | <span class="text-xs text-red-600"> |
69 | {{ $message }} | 69 | {{ $message }} |
70 | </span> | 70 | </span> |
71 | @enderror | 71 | @enderror |
72 | </div> | 72 | </div> |
73 | </div> | 73 | </div> |
74 | <div class="cabinet__inputs-item form-group"> | 74 | <div class="cabinet__inputs-item form-group"> |
75 | <label class="form-group__label">Электронная почта</label> | 75 | <label class="form-group__label">Электронная почта</label> |
76 | <div class="form-group__item"> | 76 | <div class="form-group__item"> |
77 | <input type="email" name="email" class="input" placeholder="info@rekamore.su" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" required> | 77 | <input type="email" name="email" class="input" placeholder="info@rekamore.su" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" required> |
78 | @error('email') | 78 | @error('email') |
79 | <span class="text-xs text-red-600"> | 79 | <span class="text-xs text-red-600"> |
80 | {{ $message }} | 80 | {{ $message }} |
81 | </span> | 81 | </span> |
82 | @enderror | 82 | @enderror |
83 | </div> | 83 | </div> |
84 | </div> | 84 | </div> |
85 | 85 | ||
86 | <div class="cabinet__inputs-item form-group"> | 86 | <div class="cabinet__inputs-item form-group"> |
87 | <label class="form-group__label">Электронная почта (alt)</label> | 87 | <label class="form-group__label">Электронная почта (alt)</label> |
88 | <div class="form-group__item"> | 88 | <div class="form-group__item"> |
89 | <input type="email" name="email_2" class="input" placeholder="info@rekamore.su" value="{{ old('email_2') ?? $Employer[0]->email_2 ?? '' }}"> | 89 | <input type="email" name="email_2" class="input" placeholder="info@rekamore.su" value="{{ old('email_2') ?? $Employer[0]->email_2 ?? '' }}"> |
90 | @error('email') | 90 | @error('email') |
91 | <span class="text-xs text-red-600"> | 91 | <span class="text-xs text-red-600"> |
92 | {{ $message }} | 92 | {{ $message }} |
93 | </span> | 93 | </span> |
94 | @enderror | 94 | @enderror |
95 | </div> | 95 | </div> |
96 | </div> | 96 | </div> |
97 | 97 | ||
98 | <div class="cabinet__inputs-item form-group"> | 98 | <div class="cabinet__inputs-item form-group"> |
99 | <label class="form-group__label">Номер телефона</label> | 99 | <label class="form-group__label">Номер телефона</label> |
100 | <div class="form-group__item"> | 100 | <div class="form-group__item"> |
101 | <input type="tel" name="telephone" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" required> | 101 | <input type="tel" name="telephone" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" required> |
102 | @error('telephone') | 102 | @error('telephone') |
103 | <span class="text-xs text-red-600"> | 103 | <span class="text-xs text-red-600"> |
104 | {{ $message }} | 104 | {{ $message }} |
105 | </span> | 105 | </span> |
106 | @enderror | 106 | @enderror |
107 | </div> | 107 | </div> |
108 | </div> | 108 | </div> |
109 | 109 | ||
110 | <div class="cabinet__inputs-item form-group"> | 110 | <div class="cabinet__inputs-item form-group"> |
111 | <label class="form-group__label">Номер телефона (alt)</label> | 111 | <label class="form-group__label">Номер телефона (alt)</label> |
112 | <div class="form-group__item"> | 112 | <div class="form-group__item"> |
113 | <input type="tel" name="telephone_2" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone_2') ?? $Employer[0]->telephone_2 ?? '' }}"> | 113 | <input type="tel" name="telephone_2" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone_2') ?? $Employer[0]->telephone_2 ?? '' }}"> |
114 | @error('telephone') | 114 | @error('telephone') |
115 | <span class="text-xs text-red-600"> | 115 | <span class="text-xs text-red-600"> |
116 | {{ $message }} | 116 | {{ $message }} |
117 | </span> | 117 | </span> |
118 | @enderror | 118 | @enderror |
119 | </div> | 119 | </div> |
120 | </div> | 120 | </div> |
121 | 121 | ||
122 | <div class="cabinet__inputs-item form-group"> | 122 | <div class="cabinet__inputs-item form-group"> |
123 | <label class="form-group__label">Адрес компании</label> | 123 | <label class="form-group__label">Адрес компании</label> |
124 | <div class="form-group__item"> | 124 | <div class="form-group__item"> |
125 | <input type="text" name="address" class="input" value="{{ old('address') ?? $Employer[0]->address ?? '' }}" placeholder="692904, Приморский край, г. Находка, ул. Портовая 3А, 5 этаж" required> | 125 | <input type="text" name="address" class="input" value="{{ old('address') ?? $Employer[0]->address ?? '' }}" placeholder="692904, Приморский край, г. Находка, ул. Портовая 3А, 5 этаж" required> |
126 | @error('address') | 126 | @error('address') |
127 | <span class="text-xs text-red-600"> | 127 | <span class="text-xs text-red-600"> |
128 | {{ $message }} | 128 | {{ $message }} |
129 | </span> | 129 | </span> |
130 | @enderror | 130 | @enderror |
131 | </div> | 131 | </div> |
132 | </div> | 132 | </div> |
133 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 133 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
134 | <label class="form-group__label">Ссылка на сайт</label> | 134 | <label class="form-group__label">Ссылка на сайт</label> |
135 | <div class="form-group__item"> | 135 | <div class="form-group__item"> |
136 | <input type="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su" required> | 136 | <input type="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su" required> |
137 | @error('site') | 137 | @error('site') |
138 | <span class="text-xs text-red-600"> | 138 | <span class="text-xs text-red-600"> |
139 | {{ $message }} | 139 | {{ $message }} |
140 | </span> | 140 | </span> |
141 | @enderror | 141 | @enderror |
142 | </div> | 142 | </div> |
143 | </div> | 143 | </div> |
144 | |||
145 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | ||
146 | <label class="form-group__label">Ссылка на сайт</label> | ||
147 | <div class="form-group__item"> | ||
148 | <input type="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su" required> | ||
149 | @error('site') | ||
150 | <span class="text-xs text-red-600"> | ||
151 | {{ $message }} | ||
152 | </span> | ||
153 | @enderror | ||
154 | </div> | ||
155 | </div> | ||
156 | |||
157 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | ||
158 | <label class="form-group__label">Ссылка на сайт</label> | ||
159 | <div class="form-group__item"> | ||
160 | <input type="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su" required> | ||
161 | @error('site') | ||
162 | <span class="text-xs text-red-600"> | ||
163 | {{ $message }} | ||
164 | </span> | ||
165 | @enderror | ||
166 | </div> | ||
167 | </div> | ||
168 | |||
169 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | ||
170 | <label class="form-group__label">Ссылка на сайт</label> | ||
171 | <div class="form-group__item"> | ||
172 | <input type="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su" required> | ||
173 | @error('site') | ||
174 | <span class="text-xs text-red-600"> | ||
175 | {{ $message }} | ||
176 | </span> | ||
177 | @enderror | ||
178 | </div> | ||
179 | </div> | ||
180 | |||
144 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 181 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
145 | <label class="form-group__label">О компании</label> | 182 | <label class="form-group__label">О компании</label> |
146 | <div class="form-group__item"> | 183 | <div class="form-group__item"> |
147 | <textarea name="text" id="txtarea" class="textarea ckeditor" required>{{ old('text') ?? $Employer[0]->text ?? '' }}</textarea> | 184 | <textarea name="text" id="txtarea" class="textarea ckeditor" required>{{ old('text') ?? $Employer[0]->text ?? '' }}</textarea> |
148 | @error('text') | 185 | @error('text') |
149 | <span class="text-xs text-red-600"> | 186 | <span class="text-xs text-red-600"> |
150 | {{ $message }} | 187 | {{ $message }} |
151 | </span> | 188 | </span> |
152 | @enderror | 189 | @enderror |
153 | </div> | 190 | </div> |
154 | </div> | 191 | </div> |
155 | </div> | 192 | </div> |
156 | </div><br> | 193 | </div><br> |
157 | <button type="submit" class="button cabinet__submit">Сохранить изменения</button> | 194 | <button type="submit" class="button cabinet__submit">Сохранить изменения</button> |
158 | </form> | 195 | </form> |
159 | 196 | ||
160 | </div> | 197 | </div> |
161 | </div> | 198 | </div> |
162 | </div> | 199 | </div> |
163 | 200 | ||
164 | </section> | 201 | </section> |
165 | </div> | 202 | </div> |
166 | <!-- END TOP WRAPPER --> | 203 | <!-- END TOP WRAPPER --> |
167 | @endsection | 204 | @endsection |
168 | 205 |
resources/views/employers/dialog.blade.php
1 | @extends('layout.frontend', ['title' => 'Диалог-переписка - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Диалог-переписка - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#send_btn', function() { | 6 | $(document).on('change', '#send_btn', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | console.log('sort items '+val_); | 9 | console.log('sort items '+val_); |
10 | 10 | ||
11 | $.ajax({ | 11 | $.ajax({ |
12 | type: "GET", | 12 | type: "GET", |
13 | url: "{{ route('shipping_companies') }}", | 13 | url: "{{ route('shipping_companies') }}", |
14 | data: "sort="+val_+"&block=1", | 14 | data: "sort="+val_+"&block=1", |
15 | success: function (data) { | 15 | success: function (data) { |
16 | console.log('Выбор сортировки'); | 16 | console.log('Выбор сортировки'); |
17 | console.log(data); | 17 | console.log(data); |
18 | $('#block_1').html(data); | 18 | $('#block_1').html(data); |
19 | }, | 19 | }, |
20 | headers: { | 20 | headers: { |
21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
22 | }, | 22 | }, |
23 | error: function (data) { | 23 | error: function (data) { |
24 | data = JSON.stringify(data); | 24 | data = JSON.stringify(data); |
25 | console.log('Error: ' + data); | 25 | console.log('Error: ' + data); |
26 | } | 26 | } |
27 | }); | 27 | }); |
28 | 28 | ||
29 | $.ajax({ | 29 | $.ajax({ |
30 | type: "GET", | 30 | type: "GET", |
31 | url: "{{ route('shipping_companies') }}", | 31 | url: "{{ route('shipping_companies') }}", |
32 | data: "sort="+val_+"&block=2", | 32 | data: "sort="+val_+"&block=2", |
33 | success: function (data) { | 33 | success: function (data) { |
34 | console.log('Выбор сортировки2'); | 34 | console.log('Выбор сортировки2'); |
35 | console.log(data); | 35 | console.log(data); |
36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
37 | $('#block_2').html(data); | 37 | $('#block_2').html(data); |
38 | }, | 38 | }, |
39 | headers: { | 39 | headers: { |
40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
41 | }, | 41 | }, |
42 | error: function (data) { | 42 | error: function (data) { |
43 | data = JSON.stringify(data); | 43 | data = JSON.stringify(data); |
44 | console.log('Error: ' + data); | 44 | console.log('Error: ' + data); |
45 | } | 45 | } |
46 | }); | 46 | }); |
47 | }); | 47 | }); |
48 | </script> | 48 | </script> |
49 | @endsection | 49 | @endsection |
50 | 50 | ||
51 | @section('content') | 51 | @section('content') |
52 | <section class="cabinet"> | 52 | <section class="cabinet"> |
53 | <div class="container"> | 53 | <div class="container"> |
54 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 54 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
55 | <li><a href="{{ route('index') }}">Главная</a></li> | 55 | <li><a href="{{ route('index') }}">Главная</a></li> |
56 | <li><b>Личный кабинет</b></li> | 56 | <li><b>Личный кабинет</b></li> |
57 | </ul> | 57 | </ul> |
58 | <div class="cabinet__wrapper"> | 58 | <div class="cabinet__wrapper"> |
59 | <div class="cabinet__side"> | 59 | <div class="cabinet__side"> |
60 | 60 | <div class="cabinet__side-toper"> | |
61 | @include('employers.emblema') | 61 | @include('employers.emblema') |
62 | 62 | </div> | |
63 | @include('employers.menu', ['item' => 5]) | 63 | @include('employers.menu', ['item' => 5]) |
64 | </div> | 64 | </div> |
65 | <div class="cabinet__body"> | 65 | <div class="cabinet__body"> |
66 | <div class="cabinet__body-item"> | 66 | <div class="cabinet__body-item"> |
67 | <h2 class="title cabinet__title">Сообщения</h2> | 67 | <h2 class="title cabinet__title">Сообщения</h2> |
68 | </div> | 68 | </div> |
69 | <div class="cabinet__body-item"> | 69 | <div class="cabinet__body-item"> |
70 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back"> | 70 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back"> |
71 | <svg> | 71 | <svg> |
72 | <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> | 72 | <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> |
73 | </svg> | 73 | </svg> |
74 | <span> | 74 | <span> |
75 | К списку чатов | 75 | К списку чатов |
76 | </span> | 76 | </span> |
77 | </a> | 77 | </a> |
78 | <div class="chatbox"> | 78 | <div class="chatbox"> |
79 | <div class="chatbox__toper"> | 79 | <div class="chatbox__toper"> |
80 | @if ($companion->is_worker) | 80 | @if ($companion->is_worker) |
81 | <div class="chatbox__toper-info messages__item-info"> | 81 | <div class="chatbox__toper-info messages__item-info"> |
82 | <div class="messages__item-photo"> | 82 | <div class="messages__item-photo"> |
83 | <svg> | 83 | <svg> |
84 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 84 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
85 | </svg> | 85 | </svg> |
86 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 86 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
87 | </div> | 87 | </div> |
88 | <div class="messages__item-text"> | 88 | <div class="messages__item-text"> |
89 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> | 89 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> |
90 | <div><span>Вакансия:</span> @if (!is_null($ad_employer)) <a href="{{ route('vacancie', ['vacancy' => $ad_employer->id]) }}">{{ $ad_employer->name}}</a> @else Не указано @endif</div> | 90 | <div><span>Вакансия:</span> |
91 | @if ($ad_employer == 0) | ||
92 | @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }}@else Не указано @endif | ||
93 | @else | ||
94 | <a href="{{ route('vacancie', ['vacancy' => $ad_employer]) }}"> | ||
95 | @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} ({{ $ad_employer }}) @else Не указано @endif | ||
96 | </a> | ||
97 | @endif | ||
98 | </div> | ||
91 | </div> | 99 | </div> |
92 | </div> | 100 | </div> |
93 | @if (isset($companion->worker->id)) | 101 | @if (isset($companion->worker->id)) |
94 | <a href="{{ route('resume_profile', ['worker' => $companion->worker->id]) }}" class="button chatbox__toper-button"> | 102 | <a href="{{ route('resume_profile', ['worker' => $companion->worker->id]) }}" class="button chatbox__toper-button"> |
95 | <svg> | 103 | <svg> |
96 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> | 104 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> |
97 | </svg> | 105 | </svg> |
98 | Перейти в резюме | 106 | Перейти в резюме |
99 | </a> | 107 | </a> |
100 | @endif | 108 | @endif |
101 | @else | 109 | @else |
102 | <div class="chatbox__toper-info messages__item-info"> | 110 | <div class="chatbox__toper-info messages__item-info"> |
103 | <div class="messages__item-photo"> | 111 | <div class="messages__item-photo"> |
104 | <svg> | 112 | <svg> |
105 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 113 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
106 | </svg> | 114 | </svg> |
107 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 115 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
108 | </div> | 116 | </div> |
109 | <div class="messages__item-text"> | 117 | <div class="messages__item-text"> |
110 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> | 118 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> |
111 | <div><span>Статус:</span> Работодатель или Администратор</div> | 119 | <div><span>Статус:</span> Работодатель или Администратор</div> |
112 | </div> | 120 | </div> |
113 | </div> | 121 | </div> |
114 | @if (isset($companion->employer->id)) | 122 | @if (isset($companion->employer->id)) |
115 | <a href="" class="button chatbox__toper-button"> | 123 | <a href="" class="button chatbox__toper-button"> |
116 | <svg> | 124 | <svg> |
117 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> | 125 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> |
118 | </svg> | 126 | </svg> |
119 | Перейти в резюме | 127 | Перейти в резюме |
120 | </a> | 128 | </a> |
121 | @endif | 129 | @endif |
122 | @endif | 130 | @endif |
123 | </div> | 131 | </div> |
124 | 132 | ||
125 | <div class="chatbox__list" id="dialogs" name="dialogs"> | 133 | <div class="chatbox__list" id="dialogs" name="dialogs"> |
126 | @if ($Messages->count()) | 134 | @if ($Messages->count()) |
127 | @foreach ($Messages as $it) | 135 | @foreach ($Messages as $it) |
128 | @if ($it->user_id == $companion->id) | 136 | @if ($it->user_id == $companion->id) |
129 | <div class="chatbox__item"> | 137 | <div class="chatbox__item"> |
130 | <div class="chatbox__item-photo"> | 138 | <div class="chatbox__item-photo"> |
131 | <svg> | 139 | <svg> |
132 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 140 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
133 | </svg> | 141 | </svg> |
134 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 142 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
135 | </div> | 143 | </div> |
136 | <div class="chatbox__item-body"> | 144 | <div class="chatbox__item-body"> |
137 | <div class="chatbox__item-text">{{ $it->text }}</div> | 145 | <div class="chatbox__item-text">{{ $it->text }}</div> |
138 | </div> | 146 | </div> |
139 | <div class="chatbox__item-time">{{ $it->created_at }}</div> | 147 | <div class="chatbox__item-time">{{ $it->created_at }}</div> |
140 | </div> | 148 | </div> |
141 | @else | 149 | @else |
142 | <div class="chatbox__item chatbox__item_reverse"> | 150 | <div class="chatbox__item chatbox__item_reverse"> |
143 | <div class="chatbox__item-photo"> | 151 | <div class="chatbox__item-photo"> |
144 | <svg> | 152 | <svg> |
145 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 153 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
146 | </svg> | 154 | </svg> |
147 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 155 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
148 | </div> | 156 | </div> |
149 | <div class="chatbox__item-body"> | 157 | <div class="chatbox__item-body"> |
150 | <div class="chatbox__item-text">{{ $it->text }}</div> | 158 | <div class="chatbox__item-text">{{ $it->text }}</div> |
151 | @if ((isset($it->file)) && (!empty($it->file))) | 159 | @if ((isset($it->file)) && (!empty($it->file))) |
152 | <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text"> | 160 | <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text"> |
153 | <svg> | 161 | <svg> |
154 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | 162 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> |
155 | </svg> | 163 | </svg> |
156 | </a> | 164 | </a> |
157 | @endif | 165 | @endif |
158 | </div> | 166 | </div> |
159 | <div class="chatbox__item-time">{{ $it->created_at }}</div> | 167 | <div class="chatbox__item-time">{{ $it->created_at }}</div> |
160 | </div> | 168 | </div> |
161 | @endif | 169 | @endif |
162 | 170 | ||
163 | @endforeach | 171 | @endforeach |
164 | @endif | 172 | @endif |
165 | </div> | 173 | </div> |
166 | <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > | 174 | <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > |
167 | @csrf | 175 | @csrf |
168 | <label class="chatbox__bottom-file"> | 176 | <label class="chatbox__bottom-file"> |
169 | <input id="file" name="file" type="file"> | 177 | <input id="file" name="file" type="file"> |
170 | <svg> | 178 | <svg> |
171 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | 179 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> |
172 | </svg> | 180 | </svg> |
173 | </label> | 181 | </label> |
174 | <input type="hidden" name="_token" value="{{ csrf_token() }}"/> | 182 | <input type="hidden" name="_token" value="{{ csrf_token() }}"/> |
175 | <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> | 183 | <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> |
176 | <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> | 184 | <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> |
177 | <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> | 185 | <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> |
178 | <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> | 186 | <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> |
179 | <svg> | 187 | <svg> |
180 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | 188 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> |
181 | </svg> | 189 | </svg> |
182 | </button> | 190 | </button> |
183 | </form> | 191 | </form> |
184 | </div> | 192 | </div> |
185 | </div> | 193 | </div> |
186 | </div> | 194 | </div> |
187 | </div> | 195 | </div> |
188 | </div> | 196 | </div> |
189 | </section> | 197 | </section> |
190 | </div> | 198 | </div> |
191 | @endsection | 199 | @endsection |
192 | 200 |
resources/views/employers/info.blade.php
File was created | 1 | @extends('layout.frontend', ['title' => 'Кабинет работодателя - РекаМоре']) | |
2 | |||
3 | @section('scripts') | ||
4 | <script src="https://cdn.ckeditor.com/ckeditor5/23.0.0/classic/ckeditor.js"></script> | ||
5 | <script> | ||
6 | ClassicEditor | ||
7 | .create( document.querySelector( '#text' ) ) | ||
8 | .catch( error => { | ||
9 | console.error( error ); | ||
10 | } ); | ||
11 | </script> | ||
12 | @endsection | ||
13 | @section('content') | ||
14 | <section class="cabinet"> | ||
15 | <div class="container"> | ||
16 | <ul class="breadcrumbs cabinet__breadcrumbs"> | ||
17 | <li><a href="{{ route('index') }}">Главная</a></li> | ||
18 | <li><b>Личный кабинет</b></li> | ||
19 | </ul> | ||
20 | <div class="cabinet__wrapper"> | ||
21 | <div class="cabinet__side"> | ||
22 | <div class="cabinet__side-toper"> | ||
23 | @include('employers.emblema') | ||
24 | </div> | ||
25 | @include('employers.menu', ['item' => 0]) | ||
26 | </div> | ||
27 | <div class="cabinet__body"> | ||
28 | @include('messages_error') | ||
29 | |||
30 | <form action="{{ route('employer.employer_info_save', ['user' => $user_info->id]) }}" method="POST" enctype="multipart/form-data"> | ||
31 | @csrf | ||
32 | <div class="cabinet__body-item"> | ||
33 | <div class="cabinet__descr"> | ||
34 | <h2 class="title cabinet__title">Личные данные</h2> | ||
35 | <p class="cabinet__text">Все поля обязательны для заполнения *</p> | ||
36 | </div> | ||
37 | |||
38 | <div class="cabinet__inputs"> | ||
39 | <div class="cabinet__inputs-item form-group"> | ||
40 | <label class="form-group__label">Фамилия контактера</label> | ||
41 | <div class="form-group__item"> | ||
42 | <input type="text" class="input" name="surname" id="surname" placeholder="Иванов" value="{{ old('surname') ?? $user_info->surname ?? '' }}" required> | ||
43 | @error('surname') | ||
44 | <span class="text-xs text-red-600"> | ||
45 | {{ $message }} | ||
46 | </span> | ||
47 | @enderror | ||
48 | </div> | ||
49 | </div> | ||
50 | <div class="cabinet__inputs-item form-group"> | ||
51 | <label class="form-group__label">Имя контактера</label> | ||
52 | <div class="form-group__item"> | ||
53 | <input type="text" name="name_man" class="input" placeholder="Андрей" value="{{ old('name_man') ?? $user_info->name_man ?? '' }}" required> | ||
54 | @error('name_man') | ||
55 | <span class="text-xs text-red-600"> | ||
56 | {{ $message }} | ||
57 | </span> | ||
58 | @enderror | ||
59 | </div> | ||
60 | </div> | ||
61 | |||
62 | <div class="cabinet__inputs-item form-group"> | ||
63 | <label class="form-group__label">Отчество контактера</label> | ||
64 | <div class="form-group__item"> | ||
65 | <input type="text" name="surname2" class="input" placeholder="Васильевич" value="{{ old('surname2') ?? $user_info->surname2 ?? '' }}"> | ||
66 | @error('surname2') | ||
67 | <span class="text-xs text-red-600"> | ||
68 | {{ $message }} | ||
69 | </span> | ||
70 | @enderror | ||
71 | </div> | ||
72 | </div> | ||
73 | |||
74 | <div class="cabinet__inputs-item form-group"> | ||
75 | <label class="form-group__label">Номер телефона</label> | ||
76 | <div class="form-group__item"> | ||
77 | <input type="tel" name="telephone" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone') ?? $user_info->telephone ?? '' }}" required> | ||
78 | @error('telephone') | ||
79 | <span class="text-xs text-red-600"> | ||
80 | {{ $message }} | ||
81 | </span> | ||
82 | @enderror | ||
83 | </div> | ||
84 | </div> | ||
85 | |||
86 | </div> | ||
87 | </div><br> | ||
88 | <button type="submit" class="button cabinet__submit">Сохранить изменения</button> | ||
89 | </form> | ||
90 | |||
91 | </div> | ||
92 | </div> | ||
93 | </div> | ||
94 | |||
95 | </section> | ||
96 | </div> | ||
97 | <!-- END TOP WRAPPER --> | ||
98 | @endsection | ||
99 |
resources/views/employers/menu.blade.php
1 | <div class="cabinet__side-item"> | 1 | <div class="cabinet__side-item"> |
2 | <div class="cabinet__menu"> | 2 | <div class="cabinet__menu"> |
3 | <button type="button" class="cabinet__menu-toper js-toggle"> | 3 | <button type="button" class="cabinet__menu-toper js-toggle"> |
4 | <span class="cabinet__menu-toper-text"> | 4 | <span class="cabinet__menu-toper-text"> |
5 | <i> | 5 | <i> |
6 | <svg> | 6 | <svg> |
7 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> | 7 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> |
8 | </svg> | 8 | </svg> |
9 | </i> | 9 | </i> |
10 | <span>Профиль</span> | 10 | <span>Профиль</span> |
11 | </span> | 11 | </span> |
12 | <i class="cabinet__menu-toper-arrow"> | 12 | <i class="cabinet__menu-toper-arrow"> |
13 | <svg> | 13 | <svg> |
14 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | 14 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> |
15 | </svg> | 15 | </svg> |
16 | </i> | 16 | </i> |
17 | </button> | 17 | </button> |
18 | <div class="cabinet__menu-body"> | 18 | <div class="cabinet__menu-body"> |
19 | <div class="cabinet__menu-items"> | 19 | <div class="cabinet__menu-items"> |
20 | <a href="{{ route('employer.employer_info') }}" class="cabinet__menu-item @if ($item==0) active @endif"> | ||
21 | <i> | ||
22 | <svg> | ||
23 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> | ||
24 | </svg> | ||
25 | </i> | ||
26 | <span>Личные данные</span> | ||
27 | </a> | ||
20 | <a href="{{ route('employer.cabinet') }}" class="cabinet__menu-item @if ($item==1) active @endif"> | 28 | <a href="{{ route('employer.cabinet') }}" class="cabinet__menu-item @if ($item==1) active @endif"> |
21 | <i> | 29 | <i> |
22 | <svg> | 30 | <svg> |
23 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> | 31 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> |
24 | </svg> | 32 | </svg> |
25 | </i> | 33 | </i> |
26 | <span>Профиль</span> | 34 | <span>Профиль</span> |
27 | </a> | 35 | </a> |
28 | <a href="{{ route('employer.cabinet_vacancie') }}" class="cabinet__menu-item @if ($item==2) active @endif"> | 36 | <a href="{{ route('employer.cabinet_vacancie') }}" class="cabinet__menu-item @if ($item==2) active @endif"> |
29 | <i> | 37 | <i> |
30 | <svg> | 38 | <svg> |
31 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use> | 39 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use> |
32 | </svg> | 40 | </svg> |
33 | </i> | 41 | </i> |
34 | <span>Разместить вакансию</span> | 42 | <span>Разместить вакансию</span> |
35 | </a> | 43 | </a> |
36 | <a href="{{ route('employer.vacancy_list') }}" class="cabinet__menu-item @if ($item==3) active @endif"> | 44 | <a href="{{ route('employer.vacancy_list') }}" class="cabinet__menu-item @if ($item==3) active @endif"> |
37 | <i> | 45 | <i> |
38 | <svg> | 46 | <svg> |
39 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-3') }}"></use> | 47 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-3') }}"></use> |
40 | </svg> | 48 | </svg> |
41 | </i> | 49 | </i> |
42 | <span>Мои вакансии</span> | 50 | <span>Мои вакансии</span> |
43 | </a> | 51 | </a> |
44 | <a href="{{ route('employer.answers', ['employer' => $id_employer]) }}" class="cabinet__menu-item @if ($item==4) active @endif"> | 52 | <a href="{{ route('employer.answers', ['employer' => $id_employer]) }}" class="cabinet__menu-item @if ($item==4) active @endif"> |
45 | <i> | 53 | <i> |
46 | <svg> | 54 | <svg> |
47 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-4') }}"></use> | 55 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-4') }}"></use> |
48 | </svg> | 56 | </svg> |
49 | </i> | 57 | </i> |
50 | <span>Отклики на вакансию</span> | 58 | <span>Отклики на вакансию</span> |
51 | </a> | 59 | </a> |
52 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==5) active @endif"> | 60 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==5) active @endif"> |
53 | <i> | 61 | <i> |
54 | <svg> | 62 | <svg> |
55 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use> | 63 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use> |
56 | </svg> | 64 | </svg> |
57 | </i> | 65 | </i> |
58 | <span>Сообщения</span> | 66 | <span>Сообщения</span> |
59 | </a> | 67 | </a> |
60 | <a href="{{ route('employer.favorites') }}" class="cabinet__menu-item @if ($item==6) active @endif"> | 68 | <a href="{{ route('employer.favorites') }}" class="cabinet__menu-item @if ($item==6) active @endif"> |
61 | <i> | 69 | <i> |
62 | <svg> | 70 | <svg> |
63 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use> | 71 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use> |
64 | </svg> | 72 | </svg> |
65 | </i> | 73 | </i> |
66 | <span>Избранные кандидаты</span> | 74 | <span>Избранные кандидаты</span> |
67 | </a> | 75 | </a> |
68 | <a href="{{ route('employer.bd') }}" class="cabinet__menu-item @if ($item==7) active @endif"> | 76 | <a href="{{ route('employer.bd') }}" class="cabinet__menu-item @if ($item==7) active @endif"> |
69 | <i> | 77 | <i> |
70 | <svg> | 78 | <svg> |
71 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-7')}}"></use> | 79 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-7')}}"></use> |
72 | </svg> | 80 | </svg> |
73 | </i> | 81 | </i> |
74 | <span>База данных</span> | 82 | <span>База данных</span> |
75 | </a> | 83 | </a> |
76 | <a href="{{ route('bd_resume') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif"> | 84 | <a href="{{ route('bd_resume') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif"> |
77 | <i> | 85 | <i> |
78 | <svg> | 86 | <svg> |
79 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use> | 87 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use> |
80 | </svg> | 88 | </svg> |
81 | </i> | 89 | </i> |
82 | <span>База резюме</span> | 90 | <span>База резюме</span> |
83 | </a> | 91 | </a> |
84 | <a href="{{ route('employer.send_all_messages') }}" class="cabinet__menu-item @if ($item==9) active @endif"> | 92 | <a href="{{ route('employer.send_all_messages') }}" class="cabinet__menu-item @if ($item==9) active @endif"> |
85 | <i> | 93 | <i> |
86 | <svg> | 94 | <svg> |
87 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-9') }}"></use> | 95 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-9') }}"></use> |
88 | </svg> | 96 | </svg> |
89 | </i> | 97 | </i> |
90 | <span>Рассылка сообщений</span> | 98 | <span>Рассылка сообщений</span> |
91 | </a> | 99 | </a> |
92 | <a href="{{ route('employer.faq') }}" class="cabinet__menu-item @if ($item==10) active @endif"> | 100 | <a href="{{ route('employer.faq') }}" class="cabinet__menu-item @if ($item==10) active @endif"> |
93 | <i> | 101 | <i> |
94 | <svg> | 102 | <svg> |
95 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-10') }}"></use> | 103 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-10') }}"></use> |
96 | </svg> | 104 | </svg> |
97 | </i> | 105 | </i> |
98 | <span>FAQ</span> | 106 | <span>FAQ</span> |
99 | </a> | 107 | </a> |
100 | <a href="{{ route('employer.subscribe') }}" class="cabinet__menu-item @if ($item==11) active @endif"> | 108 | <a href="{{ route('employer.subscribe') }}" class="cabinet__menu-item @if ($item==11) active @endif"> |
101 | <i> | 109 | <i> |
102 | <svg> | 110 | <svg> |
103 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> | 111 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> |
104 | </svg> | 112 | </svg> |
105 | </i> | 113 | </i> |
106 | <span>Настройки уведомлений</span> | 114 | <span>Настройки уведомлений</span> |
107 | </a> | 115 | </a> |
108 | <a href="{{ route('employer.slider_flot') }}" class="cabinet__menu-item @if ($item==12) active @endif"> | 116 | <a href="{{ route('employer.slider_flot') }}" class="cabinet__menu-item @if ($item==12) active @endif"> |
109 | <i> | 117 | <i> |
110 | <svg> | 118 | <svg> |
111 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> | 119 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> |
112 | </svg> | 120 | </svg> |
113 | </i> | 121 | </i> |
114 | <span>Мой флот</span> | 122 | <span>Мой флот</span> |
115 | </a> | 123 | </a> |
116 | <a href="{{ route('employer.password_reset') }}" class="cabinet__menu-item green @if ($item==13) active @endif"> | 124 | <a href="{{ route('employer.password_reset') }}" class="cabinet__menu-item green @if ($item==13) active @endif"> |
117 | <i></i> | 125 | <i></i> |
118 | <span>Сменить пароль</span> | 126 | <span>Сменить пароль</span> |
119 | </a> | 127 | </a> |
120 | <a href="{{ route('employer.delete_people') }}" class="cabinet__menu-item red @if ($item==14) active @endif"> | 128 | <a href="{{ route('employer.delete_people') }}" class="cabinet__menu-item red @if ($item==14) active @endif"> |
121 | <i></i> | 129 | <i></i> |
122 | <span>Удалить профиль</span> | 130 | <span>Удалить профиль</span> |
123 | </a> | 131 | </a> |
124 | </div> | 132 | </div> |
125 | <div class="cabinet__menu-bottom"> | 133 | <div class="cabinet__menu-bottom"> |
126 | <a href="{{ route('logout') }}" class="button cabinet__menu-leave"> | 134 | <a href="{{ route('logout') }}" class="button cabinet__menu-leave"> |
127 | <svg> | 135 | <svg> |
128 | <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use> | 136 | <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use> |
129 | </svg> | 137 | </svg> |
130 | Выход | 138 | Выход |
131 | </a> | 139 | </a> |
132 | <span class="cabinet__menu-copy"> | 140 | <span class="cabinet__menu-copy"> |
133 | © 2020 – Rekamore.su | 141 | © 2020 – Rekamore.su |
134 | </span> | 142 | </span> |
135 | </div> | 143 | </div> |
136 | </div> | 144 | </div> |
137 | </div> | 145 | </div> |
138 | </div> | 146 | </div> |
139 | 147 |
resources/views/employers/messages.blade.php
1 | @extends('layout.frontend', ['title' => 'Сообщения от пользователей - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Сообщения от пользователей - РекаМоре']) |
2 | @section('scripts') | 2 | @section('scripts') |
3 | <script> | 3 | <script> |
4 | console.log('Test system'); | 4 | console.log('Test system'); |
5 | $(document).on('change', '#sort_ajax', function() { | 5 | $(document).on('change', '#sort_ajax', function() { |
6 | var this_ = $(this); | 6 | var this_ = $(this); |
7 | var val_ = this_.val(); | 7 | var val_ = this_.val(); |
8 | console.log('sort items '+val_); | 8 | console.log('sort items '+val_); |
9 | 9 | ||
10 | $.ajax({ | 10 | $.ajax({ |
11 | type: "GET", | 11 | type: "GET", |
12 | url: "{{ route('shipping_companies') }}", | 12 | url: "{{ route('shipping_companies') }}", |
13 | data: "sort="+val_+"&block=1", | 13 | data: "sort="+val_+"&block=1", |
14 | success: function (data) { | 14 | success: function (data) { |
15 | console.log('Выбор сортировки'); | 15 | console.log('Выбор сортировки'); |
16 | console.log(data); | 16 | console.log(data); |
17 | $('#block_1').html(data); | 17 | $('#block_1').html(data); |
18 | }, | 18 | }, |
19 | headers: { | 19 | headers: { |
20 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 20 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
21 | }, | 21 | }, |
22 | error: function (data) { | 22 | error: function (data) { |
23 | data = JSON.stringify(data); | 23 | data = JSON.stringify(data); |
24 | console.log('Error: ' + data); | 24 | console.log('Error: ' + data); |
25 | } | 25 | } |
26 | }); | 26 | }); |
27 | 27 | ||
28 | $.ajax({ | 28 | $.ajax({ |
29 | type: "GET", | 29 | type: "GET", |
30 | url: "{{ route('shipping_companies') }}", | 30 | url: "{{ route('shipping_companies') }}", |
31 | data: "sort="+val_+"&block=2", | 31 | data: "sort="+val_+"&block=2", |
32 | success: function (data) { | 32 | success: function (data) { |
33 | console.log('Выбор сортировки2'); | 33 | console.log('Выбор сортировки2'); |
34 | console.log(data); | 34 | console.log(data); |
35 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 35 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
36 | $('#block_2').html(data); | 36 | $('#block_2').html(data); |
37 | }, | 37 | }, |
38 | headers: { | 38 | headers: { |
39 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 39 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
40 | }, | 40 | }, |
41 | error: function (data) { | 41 | error: function (data) { |
42 | data = JSON.stringify(data); | 42 | data = JSON.stringify(data); |
43 | console.log('Error: ' + data); | 43 | console.log('Error: ' + data); |
44 | } | 44 | } |
45 | }); | 45 | }); |
46 | }); | 46 | }); |
47 | </script> | 47 | </script> |
48 | @endsection | 48 | @endsection |
49 | 49 | ||
50 | @section('content') | 50 | @section('content') |
51 | <section class="cabinet"> | 51 | <section class="cabinet"> |
52 | <div class="container"> | 52 | <div class="container"> |
53 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 53 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
54 | <li><a href="{{ route('index') }}">Главная</a></li> | 54 | <li><a href="{{ route('index') }}">Главная</a></li> |
55 | <li><b>Личный кабинет</b></li> | 55 | <li><b>Личный кабинет</b></li> |
56 | </ul> | 56 | </ul> |
57 | <div class="cabinet__wrapper"> | 57 | <div class="cabinet__wrapper"> |
58 | <div class="cabinet__side"> | 58 | <div class="cabinet__side"> |
59 | <div class="cabinet__side-toper"> | 59 | <div class="cabinet__side-toper"> |
60 | @include('employers.emblema') | 60 | @include('employers.emblema') |
61 | </div> | 61 | </div> |
62 | 62 | ||
63 | 63 | ||
64 | @include('employers.menu', ['item' => 5]) | 64 | @include('employers.menu', ['item' => 5]) |
65 | </div> | 65 | </div> |
66 | 66 | ||
67 | <div class="cabinet__body"> | 67 | <div class="cabinet__body"> |
68 | <div class="cabinet__body-item"> | 68 | <div class="cabinet__body-item"> |
69 | <h2 class="title cabinet__title">Сообщения</h2> | 69 | <h2 class="title cabinet__title">Сообщения</h2> |
70 | </div> | 70 | </div> |
71 | <div class="cabinet__body-item"> | 71 | <div class="cabinet__body-item"> |
72 | <div class="cabinet__filters"> | 72 | <div class="cabinet__filters"> |
73 | <div class="cabinet__filters-item"> | 73 | <div class="cabinet__filters-item"> |
74 | <div class="cabinet__filters-buttons"> | 74 | <div class="cabinet__filters-buttons"> |
75 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a> | 75 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a> |
76 | <a href="{{ route('employer.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a> | 76 | <a href="{{ route('employer.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a> |
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | <!--<div class="cabinet__filters-item"> | 79 | <!--<div class="cabinet__filters-item"> |
80 | <div class="select"> | 80 | <div class="select"> |
81 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 81 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
82 | <option value="default">Сортировка (по умолчанию)</option> | 82 | <option value="default">Сортировка (по умолчанию)</option> |
83 | <option value="name (asc)">По имени (возрастание)</option> | 83 | <option value="name (asc)">По имени (возрастание)</option> |
84 | <option value="name (desc)">По имени (убывание)</option> | 84 | <option value="name (desc)">По имени (убывание)</option> |
85 | <option value="created_at (asc)">По дате (возрастание)</option> | 85 | <option value="created_at (asc)">По дате (возрастание)</option> |
86 | <option value="created_at (desc)">По дате (убывание)</option> | 86 | <option value="created_at (desc)">По дате (убывание)</option> |
87 | </select> | 87 | </select> |
88 | </div> | 88 | </div> |
89 | </div>--> | 89 | </div>--> |
90 | </div> | 90 | </div> |
91 | <div class="messages"> | 91 | <div class="messages"> |
92 | <!--<button type="button" class="messages__button js-toggle js-parent-toggle button button_light button_more"> | 92 | <!--<button type="button" class="messages__button js-toggle js-parent-toggle button button_light button_more"> |
93 | <span>Показать ещё</span> | 93 | <span>Показать ещё</span> |
94 | <span>Скрыть</span> | 94 | <span>Скрыть</span> |
95 | </button>--> | 95 | </button>--> |
96 | <div class="messages__body"> | 96 | <div class="messages__body"> |
97 | @if ($messages->count()) | 97 | @if ($messages->count()) |
98 | @foreach($messages as $it) | 98 | @foreach($messages as $it) |
99 | <div class="messages__item"> | 99 | <div class="messages__item"> |
100 | <div class="messages__item-info"> | 100 | <div class="messages__item-info"> |
101 | <div class="messages__item-photo"> | 101 | <div class="messages__item-photo"> |
102 | <svg> | 102 | <svg> |
103 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 103 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
104 | </svg> | 104 | </svg> |
105 | 105 | ||
106 | @if ($type_message == 'input') | 106 | @if ($type_message == 'input') |
107 | @if ($it->user_to->is_worker) | 107 | @if ($it->user_to->is_worker) |
108 | @if (isset($it->user_to->workers->phote)) | 108 | @if (isset($it->user_to->workers->phote)) |
109 | <img src="{{ asset(Storage::url($it->user_to->workers->phote)) }}" alt=""> | 109 | <img src="{{ asset(Storage::url($it->user_to->workers->phote)) }}" alt=""> |
110 | @else | 110 | @else |
111 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 111 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
112 | @endif | 112 | @endif |
113 | @else | 113 | @else |
114 | @if (isset($it->user_to->employers->logo)) | 114 | @if (isset($it->user_to->employers->logo)) |
115 | <img src="{{ asset(Storage::url($it->user_to->employers->logo)) }}" alt=""> | 115 | <img src="{{ asset(Storage::url($it->user_to->employers->logo)) }}" alt=""> |
116 | @else | 116 | @else |
117 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 117 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
118 | @endif | 118 | @endif |
119 | @endif | 119 | @endif |
120 | @endif | 120 | @endif |
121 | 121 | ||
122 | @if ($type_message == 'output') | 122 | @if ($type_message == 'output') |
123 | @if ($it->user_from->is_worker) | 123 | @if ($it->user_from->is_worker) |
124 | @if (isset($it->user_from->workers->phote)) | 124 | @if (isset($it->user_from->workers->phote)) |
125 | <img src="{{ asset(Storage::url($it->user_from->workers->phote)) }}" alt=""> | 125 | <img src="{{ asset(Storage::url($it->user_from->workers->phote)) }}" alt=""> |
126 | @else | 126 | @else |
127 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 127 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
128 | @endif | 128 | @endif |
129 | @else | 129 | @else |
130 | @if (isset($it->user_from->employers->logo)) | 130 | @if (isset($it->user_from->employers->logo)) |
131 | <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt=""> | 131 | <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt=""> |
132 | @else | 132 | @else |
133 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 133 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
134 | @endif | 134 | @endif |
135 | @endif | 135 | @endif |
136 | @endif | 136 | @endif |
137 | </div> | 137 | </div> |
138 | <div class="messages__item-text"> | 138 | <div class="messages__item-text"> |
139 | <div> | 139 | <div> |
140 | От: @if (isset($it->user_from)) | 140 | От: @if (isset($it->user_from)) |
141 | @if ($it->user_from->id !== $user_id) | 141 | @if ($it->user_from->id !== $user_id) |
142 | <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline"> | 142 | <!--<a href=" route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline">--> |
143 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} | 143 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} |
144 | </a> | 144 | <!--</a>--> |
145 | @else | 145 | @else |
146 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} | 146 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} |
147 | @endif | 147 | @endif |
148 | @else | 148 | @else |
149 | Удаленный пользователь | 149 | Удаленный пользователь |
150 | @endif | 150 | @endif |
151 | <br> | 151 | <br> |
152 | К: @if (isset($it->user_to)) | 152 | К: @if (isset($it->user_to)) |
153 | @if ($it->user_to->id !== $user_id) | 153 | @if ($it->user_to->id !== $user_id) |
154 | <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline"> | 154 | <!--<a href=" route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline">--> |
155 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} | 155 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} |
156 | </a> | 156 | <!--</a>--> |
157 | @else | 157 | @else |
158 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} | 158 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} |
159 | @endif | 159 | @endif |
160 | @else | 160 | @else |
161 | Удаленный пользователь | 161 | Удаленный пользователь |
162 | @endif | 162 | @endif |
163 | </div> | 163 | </div> |
164 | <div><span>Вакансия: {{ $it->ad_employer_id }}</span>@if (isset($it->vacancies[0])) {{ $it->vacancies[0]->name." (".($it->vacancies[0]->id).")" }} @else Удалена @endif</div> | 164 | <div> |
165 | <span>Вакансия: </span> | ||
166 | @if (isset($it->user_from)) | ||
167 | @if ($it->user_from->id !== $user_id) | ||
168 | @if (isset($it->vacancies)) | ||
169 | <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id, 'ad_employer' => $it->vacancies->id, 'ad_name' => $it->vacancies->name ]) }}" style="text-decoration: underline"> | ||
170 | {{ $it->vacancies->name." (".($it->vacancies->id).")" }} | ||
171 | </a> | ||
172 | @else | ||
173 | <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id, 'ad_employer' => 0, 'ad_name' => 'Не указана вакансия' ]) }}" style="text-decoration: underline"> | ||
174 | Вакансия не указана | ||
175 | </a> | ||
176 | @endif | ||
177 | @else | ||
178 | |||
179 | @endif | ||
180 | @endif | ||
181 | |||
182 | @if (isset($it->user_to)) | ||
183 | @if ($it->user_to->id !== $user_id) | ||
184 | @if (isset($it->vacancies)) | ||
185 | <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id, 'ad_employer' => $it->vacancies->id, 'ad_name' => $it->vacancies->name ]) }}" style="text-decoration: underline"> | ||
186 | {{ $it->vacancies->name." (".($it->vacancies->id).")" }} | ||
187 | </a> | ||
188 | @else | ||
189 | <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id, 'ad_employer' => 0, 'ad_name' => 'Не указана вакансия' ]) }}" style="text-decoration: underline"> | ||
190 | Вакансия не указана | ||
191 | </a> | ||
192 | @endif | ||
193 | @else | ||
194 | |||
195 | @endif | ||
196 | @endif | ||
197 | |||
198 | </div> | ||
165 | <div><span>Текст:</span>{{ $it->text }}</div> | 199 | <div><span>Текст:</span>{{ $it->text }}</div> |
166 | </div> | 200 | </div> |
167 | </div> | 201 | </div> |
202 | |||
168 | <div class="messages__item-date">{{ $it->created_at }}</div> | 203 | <div class="messages__item-date">{{ $it->created_at }}</div> |
169 | </div> | 204 | </div> |
170 | @endforeach | 205 | @endforeach |
206 | <div style="margin-top: 20px"> | ||
207 | {{ $messages->onEachSide(0)->appends($_GET)->links('paginate') }} | ||
208 | </div><!-- конец --> | ||
209 | @else | ||
210 | <div class="notify"> | ||
211 | <svg> | ||
212 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | ||
213 | </svg> | ||
214 | <span>Сообщений не найдено</span> | ||
215 | </div> | ||
171 | @endif | 216 | @endif |
172 | </div> | 217 | </div> |
173 | </div> | 218 | </div> |
174 | </div> | 219 | </div> |
175 | </div> | 220 | </div> |
176 | </div> | 221 | </div> |
177 | </div> | 222 | </div> |
178 | </section> | 223 | </section> |
179 | </div> | 224 | </div> |
180 | @endsection | 225 | @endsection |
181 | 226 |
resources/views/workers/messages.blade.php
1 | @extends('layout.frontend', ['title' => 'Мои сообщения - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Мои сообщения - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | 4 | ||
5 | @endsection | 5 | @endsection |
6 | 6 | ||
7 | @section('content') | 7 | @section('content') |
8 | <section class="cabinet"> | 8 | <section class="cabinet"> |
9 | <div class="container"> | 9 | <div class="container"> |
10 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 10 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
11 | <li><a href="{{ route('index') }}">Главная</a></li> | 11 | <li><a href="{{ route('index') }}">Главная</a></li> |
12 | <li><b>Личный кабинет</b></li> | 12 | <li><b>Личный кабинет</b></li> |
13 | </ul> | 13 | </ul> |
14 | <div class="cabinet__wrapper"> | 14 | <div class="cabinet__wrapper"> |
15 | <div class="cabinet__side"> | 15 | <div class="cabinet__side"> |
16 | <div class="cabinet__side-toper"> | 16 | <div class="cabinet__side-toper"> |
17 | @include('workers.emblema') | 17 | @include('workers.emblema') |
18 | 18 | ||
19 | </div> | 19 | </div> |
20 | 20 | ||
21 | @include('workers.menu', ['item' => 2]) | 21 | @include('workers.menu', ['item' => 2]) |
22 | </div> | 22 | </div> |
23 | <div class="cabinet__body"> | 23 | <div class="cabinet__body"> |
24 | <div class="cabinet__body-item"> | 24 | <div class="cabinet__body-item"> |
25 | <h2 class="title cabinet__title">Сообщения</h2> | 25 | <h2 class="title cabinet__title">Сообщения</h2> |
26 | </div> | 26 | </div> |
27 | <div class="cabinet__body-item"> | 27 | <div class="cabinet__body-item"> |
28 | <div class="cabinet__filters"> | 28 | <div class="cabinet__filters"> |
29 | <div class="cabinet__filters-item"> | 29 | <div class="cabinet__filters-item"> |
30 | <div class="cabinet__filters-buttons"> | 30 | <div class="cabinet__filters-buttons"> |
31 | <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a> | 31 | <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a> |
32 | <a href="{{ route('worker.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a> | 32 | <a href="{{ route('worker.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a> |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | <!--<div class="cabinet__filters-item"> | 35 | <!--<div class="cabinet__filters-item"> |
36 | <div class="select"> | 36 | <div class="select"> |
37 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 37 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
38 | <option value="default">Сортировка (по умолчанию)</option> | 38 | <option value="default">Сортировка (по умолчанию)</option> |
39 | <option value="name (asc)">По имени (возрастание)</option> | 39 | <option value="name (asc)">По имени (возрастание)</option> |
40 | <option value="name (desc)">По имени (убывание)</option> | 40 | <option value="name (desc)">По имени (убывание)</option> |
41 | <option value="created_at (asc)">По дате (возрастание)</option> | 41 | <option value="created_at (asc)">По дате (возрастание)</option> |
42 | <option value="created_at (desc)">По дате (убывание)</option> | 42 | <option value="created_at (desc)">По дате (убывание)</option> |
43 | </select> | 43 | </select> |
44 | </div> | 44 | </div> |
45 | </div>--> | 45 | </div>--> |
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | @if ($messages->count()) | 48 | @if ($messages->count()) |
49 | @foreach($messages as $it) | 49 | @foreach($messages as $it) |
50 | <div class="messages__item"> | 50 | <div class="messages__item"> |
51 | <div class="messages__item-info"> | 51 | <div class="messages__item-info"> |
52 | <div class="messages__item-photo"> | 52 | <div class="messages__item-photo"> |
53 | <svg> | 53 | <svg> |
54 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 54 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
55 | </svg> | 55 | </svg> |
56 | 56 | ||
57 | @if ($type_message == 'input') | 57 | @if ($type_message == 'input') |
58 | @if ($it->user_to->is_worker) | 58 | @if ($it->user_to->is_worker) |
59 | @if (isset($it->user_to->workers->phote)) | 59 | @if (isset($it->user_to->workers->phote)) |
60 | <img src="{{ asset(Storage::url($it->user_to->workers->phote)) }}" alt=""> | 60 | <img src="{{ asset(Storage::url($it->user_to->workers->phote)) }}" alt=""> |
61 | @else | 61 | @else |
62 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 62 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
63 | @endif | 63 | @endif |
64 | @else | 64 | @else |
65 | @if (isset($it->user_to->employers->logo)) | 65 | @if (isset($it->user_to->employers->logo)) |
66 | <img src="{{ asset(Storage::url($it->user_to->employers->logo)) }}" alt=""> | 66 | <img src="{{ asset(Storage::url($it->user_to->employers->logo)) }}" alt=""> |
67 | @else | 67 | @else |
68 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 68 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
69 | @endif | 69 | @endif |
70 | @endif | 70 | @endif |
71 | @endif | 71 | @endif |
72 | 72 | ||
73 | @if ($type_message == 'output') | 73 | @if ($type_message == 'output') |
74 | @if ($it->user_from->is_worker) | 74 | @if ($it->user_from->is_worker) |
75 | @if (isset($it->user_from->workers->phote)) | 75 | @if (isset($it->user_from->workers->phote)) |
76 | <img src="{{ asset(Storage::url($it->user_from->workers->phote)) }}" alt=""> | 76 | <img src="{{ asset(Storage::url($it->user_from->workers->phote)) }}" alt=""> |
77 | @else | 77 | @else |
78 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 78 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
79 | @endif | 79 | @endif |
80 | @else | 80 | @else |
81 | @if (isset($it->user_from->employers->logo)) | 81 | @if (isset($it->user_from->employers->logo)) |
82 | <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt=""> | 82 | <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt=""> |
83 | @else | 83 | @else |
84 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 84 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
85 | @endif | 85 | @endif |
86 | @endif | 86 | @endif |
87 | @endif | 87 | @endif |
88 | </div> | 88 | </div> |
89 | <div class="messages__item-text"> | 89 | <div class="messages__item-text"> |
90 | <div> | 90 | <div> |
91 | От: @if (isset($it->user_from)) | 91 | От: @if (isset($it->user_from)) |
92 | @if ($it->user_from->id !== $user_id) | 92 | @if ($it->user_from->id !== $user_id) |
93 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline"> | 93 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline"> |
94 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} | 94 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} |
95 | </a> | 95 | </a> |
96 | @else | 96 | @else |
97 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} | 97 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} |
98 | @endif | 98 | @endif |
99 | @else | 99 | @else |
100 | Удаленный пользователь | 100 | Удаленный пользователь |
101 | @endif | 101 | @endif |
102 | <br> | 102 | <br> |
103 | К: @if (isset($it->user_to)) | 103 | К: @if (isset($it->user_to)) |
104 | @if ($it->user_to->id !== $user_id) | 104 | @if ($it->user_to->id !== $user_id) |
105 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline"> | 105 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline"> |
106 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} | 106 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} |
107 | </a> | 107 | </a> |
108 | @else | 108 | @else |
109 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} | 109 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} |
110 | @endif | 110 | @endif |
111 | @else | 111 | @else |
112 | Удаленный пользователь | 112 | Удаленный пользователь |
113 | @endif | 113 | @endif |
114 | </div> | 114 | </div> |
115 | <div><span>Вакансия:</span>@if (isset($it->vacancies[0])) {{ $it->vacancies[0]->name." (".($it->vacancies[0]->id).")" }} @else Удалена @endif</div> | 115 | <div><span>Вакансия:</span>@if (isset($it->vacancies[0])) {{ $it->vacancies[0]->name." (".($it->vacancies[0]->id).")" }} @else Удалена @endif</div> |
116 | <div><span>Текст:</span>{{ $it->text }}</div> | 116 | <div><span>Текст:</span>{{ $it->text }}</div> |
117 | </div> | 117 | </div> |
118 | </div> | 118 | </div> |
119 | <div class="messages__item-date">{{ $it->created_at }}</div> | 119 | <div class="messages__item-date">{{ $it->created_at }}</div> |
120 | </div> | 120 | </div> |
121 | @endforeach | 121 | @endforeach |
122 | |||
123 | <div style="margin-top: 20px"> | ||
124 | {{ $messages->onEachSide(0)->appends($_GET)->links('paginate') }} | ||
125 | </div><!-- конец --> | ||
126 | |||
122 | @else | 127 | @else |
123 | <div class="notify"> | 128 | <div class="notify"> |
124 | <svg> | 129 | <svg> |
125 | <use xlink:href="images/sprite.svg#i"></use> | 130 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
126 | </svg> | 131 | </svg> |
127 | <span>Сообщений не найдено</span> | 132 | <span>Сообщений не найдено</span> |
128 | </div> | 133 | </div> |
129 | @endif | 134 | @endif |
130 | </div> | 135 | </div> |
131 | </div> | 136 | </div> |
132 | </div> | 137 | </div> |
133 | </div> | 138 | </div> |
134 | </section> | 139 | </section> |
135 | </div> | 140 | </div> |
136 | <div> | 141 | <div> |
137 | @endsection | 142 | @endsection |
138 | 143 |
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\Admin\EmployersController; | 9 | use App\Http\Controllers\Admin\EmployersController; |
10 | use App\Http\Controllers\EmployerController as FrontEmployersController; | 10 | use App\Http\Controllers\EmployerController as FrontEmployersController; |
11 | use App\Http\Controllers\Admin\InfoBloksController; | 11 | use App\Http\Controllers\Admin\InfoBloksController; |
12 | use App\Http\Controllers\Admin\JobTitlesController; | 12 | use App\Http\Controllers\Admin\JobTitlesController; |
13 | use App\Http\Controllers\Admin\UsersController; | 13 | use App\Http\Controllers\Admin\UsersController; |
14 | use App\Http\Controllers\Admin\WorkersController; | 14 | use App\Http\Controllers\Admin\WorkersController; |
15 | use App\Http\Controllers\Auth\ForgotPasswordController; | 15 | use App\Http\Controllers\Auth\ForgotPasswordController; |
16 | use App\Http\Controllers\Auth\LoginController; | 16 | use App\Http\Controllers\Auth\LoginController; |
17 | use App\Http\Controllers\Auth\RegisterController; | 17 | use App\Http\Controllers\Auth\RegisterController; |
18 | use App\Http\Controllers\CKEditorController; | 18 | use App\Http\Controllers\CKEditorController; |
19 | use App\Http\Controllers\MediaController; | 19 | use App\Http\Controllers\MediaController; |
20 | use App\Http\Controllers\WorkerController; | 20 | use App\Http\Controllers\WorkerController; |
21 | use App\Models\Ad_jobs; | 21 | use App\Models\Ad_jobs; |
22 | use App\Models\User; | 22 | use App\Models\User; |
23 | use App\Http\Controllers\MainController; | 23 | use App\Http\Controllers\MainController; |
24 | use App\Http\Controllers\HomeController; | 24 | use App\Http\Controllers\HomeController; |
25 | use Illuminate\Support\Facades\Route; | 25 | use Illuminate\Support\Facades\Route; |
26 | use App\Http\Controllers\Admin\CompanyController; | 26 | use App\Http\Controllers\Admin\CompanyController; |
27 | use App\Http\Controllers\Admin\Ad_EmployersController; | 27 | use App\Http\Controllers\Admin\Ad_EmployersController; |
28 | use App\Http\Controllers\Admin\MsgAnswersController; | 28 | use App\Http\Controllers\Admin\MsgAnswersController; |
29 | use App\Http\Controllers\Admin\GroupsController; | 29 | use App\Http\Controllers\Admin\GroupsController; |
30 | use App\Http\Controllers\PagesController; | 30 | use App\Http\Controllers\PagesController; |
31 | use Illuminate\Support\Facades\Storage; | 31 | use Illuminate\Support\Facades\Storage; |
32 | use App\Http\Controllers\EmployerController; | 32 | use App\Http\Controllers\EmployerController; |
33 | use App\Http\Controllers\CompanyController as FrontCompanyController; | 33 | use App\Http\Controllers\CompanyController as FrontCompanyController; |
34 | 34 | ||
35 | 35 | ||
36 | /* | 36 | /* |
37 | |-------------------------------------------------------------------------- | 37 | |-------------------------------------------------------------------------- |
38 | | Web Routes | 38 | | Web Routes |
39 | |-------------------------------------------------------------------------- | 39 | |-------------------------------------------------------------------------- |
40 | | | 40 | | |
41 | | Here is where you can register web routes for your application. These | 41 | | Here is where you can register web routes for your application. These |
42 | | routes are loaded by the RouteServiceProvider within a group which | 42 | | routes are loaded by the RouteServiceProvider within a group which |
43 | | contains the "web" middleware group. Now create something great! | 43 | | contains the "web" middleware group. Now create something great! |
44 | | | 44 | | |
45 | */ | 45 | */ |
46 | /* | 46 | /* |
47 | Route::get('/', function () { | 47 | Route::get('/', function () { |
48 | return view('welcome'); | 48 | return view('welcome'); |
49 | })->name('index'); | 49 | })->name('index'); |
50 | */ | 50 | */ |
51 | 51 | ||
52 | Route::get('/', [MainController::class, 'index'])->name('index'); | 52 | Route::get('/', [MainController::class, 'index'])->name('index'); |
53 | 53 | ||
54 | //Роуты авторизации, регистрации, восстановления, аутентификации | 54 | //Роуты авторизации, регистрации, восстановления, аутентификации |
55 | Auth::routes(['verify' => true]); | 55 | Auth::routes(['verify' => true]); |
56 | 56 | ||
57 | // роуты регистрации, авторизации, восстановления пароля, верификации почты | 57 | // роуты регистрации, авторизации, восстановления пароля, верификации почты |
58 | /*Route::group([ | 58 | /*Route::group([ |
59 | 'as' => 'auth.', //имя маршрута, например auth.index | 59 | 'as' => 'auth.', //имя маршрута, например auth.index |
60 | 'prefix' => 'auth', // префикс маршрута, например, auth/index | 60 | 'prefix' => 'auth', // префикс маршрута, например, auth/index |
61 | ], function () { | 61 | ], function () { |
62 | //форма регистрации | 62 | //форма регистрации |
63 | Route::get('register', [RegisterController::class, 'register'])->name('register'); | 63 | Route::get('register', [RegisterController::class, 'register'])->name('register'); |
64 | 64 | ||
65 | //создание пользователя | 65 | //создание пользователя |
66 | Route::post('register', [RegisterController::class, 'create'])->name('create'); | 66 | Route::post('register', [RegisterController::class, 'create'])->name('create'); |
67 | 67 | ||
68 | //форма входа авторизации | 68 | //форма входа авторизации |
69 | Route::get('login', [LoginController::class, 'login'])->name('login'); | 69 | Route::get('login', [LoginController::class, 'login'])->name('login'); |
70 | 70 | ||
71 | //аутентификация | 71 | //аутентификация |
72 | Route::post('login', [LoginController::class, 'authenticate'])->name('auth'); | 72 | Route::post('login', [LoginController::class, 'authenticate'])->name('auth'); |
73 | 73 | ||
74 | //выход | 74 | //выход |
75 | Route::get('logout', [LoginController::class, 'logout'])->name('logout'); | 75 | Route::get('logout', [LoginController::class, 'logout'])->name('logout'); |
76 | 76 | ||
77 | //форма ввода адреса почты | 77 | //форма ввода адреса почты |
78 | Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form'); | 78 | Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form'); |
79 | 79 | ||
80 | //письмо на почту | 80 | //письмо на почту |
81 | Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail'); | 81 | Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail'); |
82 | 82 | ||
83 | //форма восстановления пароля | 83 | //форма восстановления пароля |
84 | Route::get('reset-password/token/{token}/email/{email}', | 84 | Route::get('reset-password/token/{token}/email/{email}', |
85 | [ResetPasswordController::class, 'form'] | 85 | [ResetPasswordController::class, 'form'] |
86 | )->name('reset-form'); | 86 | )->name('reset-form'); |
87 | 87 | ||
88 | //восстановление пароля | 88 | //восстановление пароля |
89 | Route::post('reset-password', | 89 | Route::post('reset-password', |
90 | [ResetPasswordController::class, 'reset'] | 90 | [ResetPasswordController::class, 'reset'] |
91 | )->name('reset-password'); | 91 | )->name('reset-password'); |
92 | 92 | ||
93 | //сообщение о необходимости проверки адреса почты | 93 | //сообщение о необходимости проверки адреса почты |
94 | Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message'); | 94 | Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message'); |
95 | 95 | ||
96 | //подтверждение адреса почты нового пользователя | 96 | //подтверждение адреса почты нового пользователя |
97 | Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify']) | 97 | Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify']) |
98 | ->where('token', '[a-f0-9]{32}') | 98 | ->where('token', '[a-f0-9]{32}') |
99 | ->where('id', '[0-9]+') | 99 | ->where('id', '[0-9]+') |
100 | ->name('verify-email'); | 100 | ->name('verify-email'); |
101 | });*/ | 101 | });*/ |
102 | 102 | ||
103 | //Личный кабинет пользователя | 103 | //Личный кабинет пользователя |
104 | Route::get('/home', [HomeController::class, 'index'])->name('home'); | 104 | Route::get('/home', [HomeController::class, 'index'])->name('home'); |
105 | 105 | ||
106 | /* | 106 | /* |
107 | Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { | 107 | Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { |
108 | $user = User::where('email',$request->input('email'))->first(); | 108 | $user = User::where('email',$request->input('email'))->first(); |
109 | 109 | ||
110 | $user->sendEmailVerificationNotification(); | 110 | $user->sendEmailVerificationNotification(); |
111 | 111 | ||
112 | return 'your response'; | 112 | return 'your response'; |
113 | })->middleware('throttle:6,1')->name('verification.resend'); | 113 | })->middleware('throttle:6,1')->name('verification.resend'); |
114 | */ | 114 | */ |
115 | 115 | ||
116 | // Авторизация, регистрация в админку | 116 | // Авторизация, регистрация в админку |
117 | Route::group([ | 117 | Route::group([ |
118 | 'as' => 'admin.', // имя маршрута, например auth.index | 118 | 'as' => 'admin.', // имя маршрута, например auth.index |
119 | 'prefix' => 'admin', // префикс маршрута, например auth/index | 119 | 'prefix' => 'admin', // префикс маршрута, например auth/index |
120 | 'middleware' => ['guest'], | 120 | 'middleware' => ['guest'], |
121 | ], function () { | 121 | ], function () { |
122 | // Форма регистрации | 122 | // Форма регистрации |
123 | Route::get('register', [AdminController::class, 'register'])->name('register'); | 123 | Route::get('register', [AdminController::class, 'register'])->name('register'); |
124 | // Создание пользователя | 124 | // Создание пользователя |
125 | Route::post('register', [AdminController::class, 'create'])->name('create'); | 125 | Route::post('register', [AdminController::class, 'create'])->name('create'); |
126 | 126 | ||
127 | //Форма входа | 127 | //Форма входа |
128 | Route::get('login', [AdminController::class, 'login'])->name('login'); | 128 | Route::get('login', [AdminController::class, 'login'])->name('login'); |
129 | 129 | ||
130 | // аутентификация | 130 | // аутентификация |
131 | Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); | 131 | Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); |
132 | 132 | ||
133 | }); | 133 | }); |
134 | 134 | ||
135 | // Личный кабинет админки | 135 | // Личный кабинет админки |
136 | Route::group([ | 136 | Route::group([ |
137 | 'as' => 'admin.', // имя маршрута, например auth.index | 137 | 'as' => 'admin.', // имя маршрута, например auth.index |
138 | 'prefix' => 'admin', // префикс маршрута, например auth/index | 138 | 'prefix' => 'admin', // префикс маршрута, например auth/index |
139 | 'middleware' => ['auth'], ['admin'], | 139 | 'middleware' => ['auth'], ['admin'], |
140 | ], function() { | 140 | ], function() { |
141 | 141 | ||
142 | // выход | 142 | // выход |
143 | Route::get('logout', [AdminController::class, 'logout'])->name('logout'); | 143 | Route::get('logout', [AdminController::class, 'logout'])->name('logout'); |
144 | 144 | ||
145 | // кабинет главная страница | 145 | // кабинет главная страница |
146 | Route::get('cabinet', [AdminController::class, 'index'])->name('index'); | 146 | Route::get('cabinet', [AdminController::class, 'index'])->name('index'); |
147 | 147 | ||
148 | // кабинет профиль админа - форма | 148 | // кабинет профиль админа - форма |
149 | Route::get('profile', [AdminController::class, 'profile'])->name('profile'); | 149 | Route::get('profile', [AdminController::class, 'profile'])->name('profile'); |
150 | // кабинет профиль админа - сохранение формы | 150 | // кабинет профиль админа - сохранение формы |
151 | Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); | 151 | Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); |
152 | 152 | ||
153 | //кабинет сообщения админа | 153 | //кабинет сообщения админа |
154 | //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); | 154 | //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); |
155 | 155 | ||
156 | 156 | ||
157 | // кабинет профиль - форма пароли | 157 | // кабинет профиль - форма пароли |
158 | Route::get('password', [AdminController::class, 'profile_password'])->name('password'); | 158 | Route::get('password', [AdminController::class, 'profile_password'])->name('password'); |
159 | // кабинет профиль - сохранение формы пароля | 159 | // кабинет профиль - сохранение формы пароля |
160 | Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); | 160 | Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); |
161 | 161 | ||
162 | 162 | ||
163 | // кабинет профиль пользователя - форма | 163 | // кабинет профиль пользователя - форма |
164 | Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); | 164 | Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); |
165 | // кабинет профиль пользователя - сохранение формы | 165 | // кабинет профиль пользователя - сохранение формы |
166 | Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); | 166 | Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); |
167 | 167 | ||
168 | // кабинет профиль работодатель - форма | 168 | // кабинет профиль работодатель - форма |
169 | Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); | 169 | Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); |
170 | // кабинет профиль работодатель - сохранение формы | 170 | // кабинет профиль работодатель - сохранение формы |
171 | Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); | 171 | Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); |
172 | // кабинет удаление профиль работодателя и юзера | 172 | // кабинет удаление профиль работодателя и юзера |
173 | Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); | 173 | Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); |
174 | 174 | ||
175 | // кабинет профиль работник - форма | 175 | // кабинет профиль работник - форма |
176 | Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); | 176 | Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); |
177 | Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); | 177 | Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); |
178 | Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); | 178 | Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); |
179 | // кабинет профиль работник - сохранение формы | 179 | // кабинет профиль работник - сохранение формы |
180 | Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); | 180 | Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); |
181 | 181 | ||
182 | // Медиа | 182 | // Медиа |
183 | Route::get('media', [MediaController::class, 'index'])->name('media'); | 183 | Route::get('media', [MediaController::class, 'index'])->name('media'); |
184 | Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); | 184 | Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); |
185 | 185 | ||
186 | // кабинет настройки сайта - форма | 186 | // кабинет настройки сайта - форма |
187 | Route::get('config', [AdminController::class, 'config_form'])->name('config'); | 187 | Route::get('config', [AdminController::class, 'config_form'])->name('config'); |
188 | // кабинет настройки сайта сохранение формы | 188 | // кабинет настройки сайта сохранение формы |
189 | Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); | 189 | Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); |
190 | 190 | ||
191 | // кабинет - новости | 191 | // кабинет - новости |
192 | Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin'); | 192 | Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin'); |
193 | Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add'); | 193 | Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add'); |
194 | Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add'); | 194 | Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add'); |
195 | Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit'); | 195 | Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit'); |
196 | Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update'); | 196 | Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update'); |
197 | Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete'); | 197 | Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete'); |
198 | 198 | ||
199 | // кабинет - пользователи | 199 | // кабинет - пользователи |
200 | Route::get('users', [UsersController::class, 'index'])->name('users'); | 200 | Route::get('users', [UsersController::class, 'index'])->name('users'); |
201 | 201 | ||
202 | // кабинет - пользователи | 202 | // кабинет - пользователи |
203 | Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); | 203 | Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); |
204 | 204 | ||
205 | // кабинет - работодатели | 205 | // кабинет - работодатели |
206 | Route::get('employers', [EmployersController::class, 'index'])->name('employers'); | 206 | Route::get('employers', [EmployersController::class, 'index'])->name('employers'); |
207 | 207 | ||
208 | Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer'); | 208 | Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer'); |
209 | 209 | ||
210 | Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add'); | 210 | Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add'); |
211 | Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save'); | 211 | Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save'); |
212 | Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot'); | 212 | Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot'); |
213 | Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit'); | 213 | Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit'); |
214 | Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete'); | 214 | Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete'); |
215 | 215 | ||
216 | // кабинет - соискатели | 216 | // кабинет - соискатели |
217 | Route::get('workers', [WorkersController::class, 'index'])->name('workers'); | 217 | Route::get('workers', [WorkersController::class, 'index'])->name('workers'); |
218 | 218 | ||
219 | // кабинет - база данных | 219 | // кабинет - база данных |
220 | Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata'); | 220 | Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata'); |
221 | Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata'); | 221 | Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata'); |
222 | Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata'); | 222 | Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata'); |
223 | Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata'); | 223 | Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata'); |
224 | Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata'); | 224 | Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata'); |
225 | Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata'); | 225 | Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata'); |
226 | Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata'); | 226 | Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata'); |
227 | 227 | ||
228 | // кабинет - вакансии | 228 | // кабинет - вакансии |
229 | Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); | 229 | Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); |
230 | Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers'); | 230 | Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers'); |
231 | Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers'); | 231 | Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers'); |
232 | Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); | 232 | Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); |
233 | Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); | 233 | Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); |
234 | Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer'); | 234 | Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer'); |
235 | 235 | ||
236 | // Редактирование должности в вакансии | 236 | // Редактирование должности в вакансии |
237 | Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs'); | 237 | Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs'); |
238 | Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs'); | 238 | Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs'); |
239 | 239 | ||
240 | 240 | ||
241 | // кабинет - категории | 241 | // кабинет - категории |
242 | //Route::get('categories', [AdminController::class, 'index'])->name('categories'); | 242 | //Route::get('categories', [AdminController::class, 'index'])->name('categories'); |
243 | 243 | ||
244 | // СRUD-операции над Справочником Категории | 244 | // СRUD-операции над Справочником Категории |
245 | 245 | ||
246 | Route::resource('categories', CategoryController::class, ['except' => ['show']]); | 246 | Route::resource('categories', CategoryController::class, ['except' => ['show']]); |
247 | 247 | ||
248 | // CRUD-операции над справочником Категории для работодателей | 248 | // CRUD-операции над справочником Категории для работодателей |
249 | Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]); | 249 | Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]); |
250 | 250 | ||
251 | // CRUD-операции над справочником Образование | 251 | // CRUD-операции над справочником Образование |
252 | Route::resource('education', EducationController::class, ['except' => ['show']]); | 252 | Route::resource('education', EducationController::class, ['except' => ['show']]); |
253 | 253 | ||
254 | Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education'); | 254 | Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education'); |
255 | Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); | 255 | Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); |
256 | Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); | 256 | Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); |
257 | 257 | ||
258 | Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education'); | 258 | Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education'); |
259 | Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education'); | 259 | Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education'); |
260 | 260 | ||
261 | Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education'); | 261 | Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education'); |
262 | 262 | ||
263 | //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); | 263 | //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); |
264 | /* | 264 | /* |
265 | * кабинет - CRUD-операции по справочнику должности | 265 | * кабинет - CRUD-операции по справочнику должности |
266 | * | 266 | * |
267 | */ | 267 | */ |
268 | Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); | 268 | Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); |
269 | 269 | ||
270 | // кабинет - сообщения (чтение чужих) | 270 | // кабинет - сообщения (чтение чужих) |
271 | Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); | 271 | Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); |
272 | // кабинет - просмотр сообщения чужого (чтение) | 272 | // кабинет - просмотр сообщения чужого (чтение) |
273 | Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message'); | 273 | Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message'); |
274 | 274 | ||
275 | // кабинет - сообщения (админские) | 275 | // кабинет - сообщения (админские) |
276 | Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); | 276 | Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); |
277 | // кабинет - сообщения (админские) | 277 | // кабинет - сообщения (админские) |
278 | Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); | 278 | Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); |
279 | // кабинет - sql - конструкция запросов | 279 | // кабинет - sql - конструкция запросов |
280 | Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql'); | 280 | Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql'); |
281 | 281 | ||
282 | /* | 282 | /* |
283 | * Расписанный подход в описании каждой директорий групп пользователей. | 283 | * Расписанный подход в описании каждой директорий групп пользователей. |
284 | */ | 284 | */ |
285 | // кабинет - группы пользователей | 285 | // кабинет - группы пользователей |
286 | Route::get('groups', [GroupsController::class, 'index'])->name('groups'); | 286 | Route::get('groups', [GroupsController::class, 'index'])->name('groups'); |
287 | // кабинет - добавление форма группы пользователей | 287 | // кабинет - добавление форма группы пользователей |
288 | Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); | 288 | Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); |
289 | // кабинет - сохранение формы группы пользователей | 289 | // кабинет - сохранение формы группы пользователей |
290 | Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); | 290 | Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); |
291 | // кабинет - редактирование форма группы пользователей | 291 | // кабинет - редактирование форма группы пользователей |
292 | Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); | 292 | Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); |
293 | // кабинет - сохранение редактированной формы группы пользователей | 293 | // кабинет - сохранение редактированной формы группы пользователей |
294 | Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); | 294 | Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); |
295 | // кабинет - удаление группы пользователей | 295 | // кабинет - удаление группы пользователей |
296 | Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); | 296 | Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); |
297 | 297 | ||
298 | 298 | ||
299 | // кабинет - список админов | 299 | // кабинет - список админов |
300 | Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); | 300 | Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); |
301 | 301 | ||
302 | // справочник Позиции | 302 | // справочник Позиции |
303 | Route::get('positions', [AdminController::class, 'position'])->name('position'); | 303 | Route::get('positions', [AdminController::class, 'position'])->name('position'); |
304 | Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position'); | 304 | Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position'); |
305 | Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position'); | 305 | Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position'); |
306 | Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position'); | 306 | Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position'); |
307 | Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position'); | 307 | Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position'); |
308 | Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position'); | 308 | Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position'); |
309 | 309 | ||
310 | /////редактор////// кабинет - редактор сайта//////////////////////// | 310 | /////редактор////// кабинет - редактор сайта//////////////////////// |
311 | Route::get('editor-site', function() { | 311 | Route::get('editor-site', function() { |
312 | return view('admin.editor.index'); | 312 | return view('admin.editor.index'); |
313 | })->name('editor-site'); | 313 | })->name('editor-site'); |
314 | 314 | ||
315 | 315 | ||
316 | // кабинет - редактор шапки-футера сайта | 316 | // кабинет - редактор шапки-футера сайта |
317 | Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); | 317 | Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); |
318 | Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); | 318 | Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); |
319 | Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); | 319 | Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); |
320 | Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); | 320 | Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); |
321 | Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); | 321 | Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); |
322 | Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); | 322 | Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); |
323 | Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); | 323 | Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); |
324 | 324 | ||
325 | 325 | ||
326 | // кабинет - редактор должности на главной | 326 | // кабинет - редактор должности на главной |
327 | Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); | 327 | Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); |
328 | 328 | ||
329 | // кабинет - редактор работодатели на главной | 329 | // кабинет - редактор работодатели на главной |
330 | Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); | 330 | Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); |
331 | 331 | ||
332 | 332 | ||
333 | // кабинет - редактор seo-сайта | 333 | // кабинет - редактор seo-сайта |
334 | Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); | 334 | Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); |
335 | Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); | 335 | Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); |
336 | Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); | 336 | Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); |
337 | Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); | 337 | Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); |
338 | Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); | 338 | Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); |
339 | Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); | 339 | Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); |
340 | Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); | 340 | Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); |
341 | 341 | ||
342 | 342 | ||
343 | // кабинет - редактор страниц | 343 | // кабинет - редактор страниц |
344 | Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); | 344 | Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); |
345 | // кабинет - добавление страницы | 345 | // кабинет - добавление страницы |
346 | Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); | 346 | Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); |
347 | // кабинет - сохранение формы страницы | 347 | // кабинет - сохранение формы страницы |
348 | Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); | 348 | Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); |
349 | // кабинет - редактирование форма страницы | 349 | // кабинет - редактирование форма страницы |
350 | Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); | 350 | Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); |
351 | // кабинет - сохранение редактированной формы страницы | 351 | // кабинет - сохранение редактированной формы страницы |
352 | Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); | 352 | Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); |
353 | // кабинет - удаление страницы | 353 | // кабинет - удаление страницы |
354 | Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); | 354 | Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); |
355 | 355 | ||
356 | 356 | ||
357 | // кабинет - реклама сайта | 357 | // кабинет - реклама сайта |
358 | Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); | 358 | Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); |
359 | Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); | 359 | Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); |
360 | Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); | 360 | Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); |
361 | Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); | 361 | Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); |
362 | Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); | 362 | Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); |
363 | Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); | 363 | Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); |
364 | //////////////////////////////////////////////////////////////////////// | 364 | //////////////////////////////////////////////////////////////////////// |
365 | 365 | ||
366 | 366 | ||
367 | // кабинет - отзывы о работодателе для модерации | 367 | // кабинет - отзывы о работодателе для модерации |
368 | Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); | 368 | Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); |
369 | 369 | ||
370 | // Общая страница статистики | 370 | // Общая страница статистики |
371 | Route::get('statics', function () { | 371 | Route::get('statics', function () { |
372 | return view('admin.static.index'); | 372 | return view('admin.static.index'); |
373 | })->name('statics'); | 373 | })->name('statics'); |
374 | 374 | ||
375 | // кабинет - статистика работников | 375 | // кабинет - статистика работников |
376 | Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); | 376 | Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); |
377 | 377 | ||
378 | // кабинет - статистика вакансий работодателя | 378 | // кабинет - статистика вакансий работодателя |
379 | Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); | 379 | Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); |
380 | 380 | ||
381 | // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника | 381 | // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника |
382 | /* | 382 | /* |
383 | * CRUD-операции над справочником дипломы и документы | 383 | * CRUD-операции над справочником дипломы и документы |
384 | */ | 384 | */ |
385 | //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); | 385 | //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); |
386 | Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); | 386 | Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); |
387 | 387 | ||
388 | // кабинет - роли пользователя | 388 | // кабинет - роли пользователя |
389 | Route::get('roles', [UsersController::class, 'roles'])->name('roles'); | 389 | Route::get('roles', [UsersController::class, 'roles'])->name('roles'); |
390 | 390 | ||
391 | Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles'); | 391 | Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles'); |
392 | 392 | ||
393 | Route::get('logs', function() { | 393 | Route::get('logs', function() { |
394 | $files = Storage::files('logs/laravel.log'); | 394 | $files = Storage::files('logs/laravel.log'); |
395 | })->name('logs'); | 395 | })->name('logs'); |
396 | }); | 396 | }); |
397 | 397 | ||
398 | // Инструментальные страницы | 398 | // Инструментальные страницы |
399 | Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); | 399 | Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); |
400 | 400 | ||
401 | Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); | 401 | Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); |
402 | 402 | ||
403 | Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); | 403 | Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); |
404 | 404 | ||
405 | // Страницы с произвольным контентом | 405 | // Страницы с произвольным контентом |
406 | Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); | 406 | Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); |
407 | 407 | ||
408 | // Публичные страницы соискателя | 408 | // Публичные страницы соискателя |
409 | Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); | 409 | Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); |
410 | 410 | ||
411 | //Страница вакансии | 411 | //Страница вакансии |
412 | Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer'); | 412 | Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer'); |
413 | 413 | ||
414 | //Вакансии | 414 | //Вакансии |
415 | Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies'); | 415 | Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies'); |
416 | 416 | ||
417 | //Вакансии поиск на главной | 417 | //Вакансии поиск на главной |
418 | Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies'); | 418 | Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies'); |
419 | 419 | ||
420 | //Вакансии категория детальная | 420 | //Вакансии категория детальная |
421 | Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); | 421 | Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); |
422 | 422 | ||
423 | // Лайк вакансии | 423 | // Лайк вакансии |
424 | Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy'); | 424 | Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy'); |
425 | 425 | ||
426 | //Детальная страница вакансии - работодателя | 426 | //Детальная страница вакансии - работодателя |
427 | Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); | 427 | Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); |
428 | 428 | ||
429 | //Судоходные компании | 429 | //Судоходные компании |
430 | Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies'); | 430 | Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies'); |
431 | 431 | ||
432 | //Детальная инфа о компании | 432 | //Детальная инфа о компании |
433 | Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company'); | 433 | Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company'); |
434 | 434 | ||
435 | //Образование | 435 | //Образование |
436 | Route::get('education', [MainController::class, 'education'])->name('education'); | 436 | Route::get('education', [MainController::class, 'education'])->name('education'); |
437 | 437 | ||
438 | //Новости | 438 | //Новости |
439 | Route::get('news', [MainController::class, 'news'])->name('news'); | 439 | Route::get('news', [MainController::class, 'news'])->name('news'); |
440 | Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new'); | 440 | Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new'); |
441 | 441 | ||
442 | //Контакты | 442 | //Контакты |
443 | Route::get('contacts', [MainController::class, 'contacts'])->name('contacts'); | 443 | Route::get('contacts', [MainController::class, 'contacts'])->name('contacts'); |
444 | 444 | ||
445 | //База резюме | 445 | //База резюме |
446 | Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume'); | 446 | Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume'); |
447 | 447 | ||
448 | Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume'); | 448 | Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume'); |
449 | 449 | ||
450 | //Анкета соискателя | 450 | //Анкета соискателя |
451 | Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile'); | 451 | Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile'); |
452 | 452 | ||
453 | //Скачать резюме | 453 | //Скачать резюме |
454 | Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download'); | 454 | Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download'); |
455 | Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2'); | 455 | Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2'); |
456 | Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all'); | 456 | Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all'); |
457 | 457 | ||
458 | 458 | ||
459 | //Вход в кабинет | 459 | //Вход в кабинет |
460 | Route::get('login', [MainController::class, 'input_login'])->name('login'); | 460 | Route::get('login', [MainController::class, 'input_login'])->name('login'); |
461 | 461 | ||
462 | // Выход из кабинета | 462 | // Выход из кабинета |
463 | Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); | 463 | Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); |
464 | 464 | ||
465 | Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); | 465 | Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); |
466 | Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); | 466 | Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); |
467 | 467 | ||
468 | //восстановление пароля | 468 | //восстановление пароля |
469 | Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); | 469 | Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); |
470 | // Звезда сообщения | 470 | // Звезда сообщения |
471 | Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer'); | 471 | Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer'); |
472 | 472 | ||
473 | // Борьба | 473 | // Борьба |
474 | Route::get('clear_cookie', function() { | 474 | Route::get('clear_cookie', function() { |
475 | \App\Classes\Cookies_vacancy::clear_vacancy(); | 475 | \App\Classes\Cookies_vacancy::clear_vacancy(); |
476 | return redirect()->route('index'); | 476 | return redirect()->route('index'); |
477 | })->name('clear_cookie'); | 477 | })->name('clear_cookie'); |
478 | 478 | ||
479 | Route::get('cookies', function() { | 479 | Route::get('cookies', function() { |
480 | return view('cookies'); | 480 | return view('cookies'); |
481 | })->name('cookies'); | 481 | })->name('cookies'); |
482 | 482 | ||
483 | |||
484 | |||
485 | |||
486 | // Личный кабинет работник | 483 | // Личный кабинет работник |
487 | Route::group([ | 484 | Route::group([ |
488 | 'as' => 'worker.', // имя маршрута, например auth.index | 485 | 'as' => 'worker.', // имя маршрута, например auth.index |
489 | 'prefix' => 'worker', // префикс маршрута, например auth/index | 486 | 'prefix' => 'worker', // префикс маршрута, например auth/index |
490 | 'middleware' => ['auth'], ['is_worker'], | 487 | 'middleware' => ['auth'], ['is_worker'], |
491 | ], function() { | 488 | ], function() { |
492 | // 1 страница - Моя анкета | 489 | // 1 страница - Моя анкета |
493 | Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet'); | 490 | Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet'); |
494 | Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save'); | 491 | Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save'); |
495 | 492 | ||
496 | // 2 страница - Сообщения | 493 | // 2 страница - Сообщения |
497 | Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages'); | 494 | Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages'); |
498 | Route::get('cabinet/dialog/{user1}/{user2}', [WorkerController::class, 'dialog'])->name('dialog'); | 495 | Route::get('cabinet/dialog/{user1}/{user2}', [WorkerController::class, 'dialog'])->name('dialog'); |
499 | // 3 страница - Избранные вакансии | 496 | // 3 страница - Избранные вакансии |
500 | Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite'); | 497 | Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite'); |
501 | // Продолжение борьбы против колорадов - избранные вакансии | 498 | // Продолжение борьбы против колорадов - избранные вакансии |
502 | Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado'); | 499 | Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado'); |
503 | 500 | ||
504 | // 4 страница - Сменить пароль | 501 | // 4 страница - Сменить пароль |
505 | Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password'); | 502 | Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password'); |
506 | Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password'); | 503 | Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password'); |
507 | 504 | ||
508 | // 5 страница - Удалить профиль | 505 | // 5 страница - Удалить профиль |
509 | Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile'); | 506 | Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile'); |
510 | Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result'); | 507 | Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result'); |
511 | 508 | ||
512 | // Резюме -pdf | 509 | // Резюме -pdf |
513 | Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download'); | 510 | Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download'); |
514 | 511 | ||
515 | // Поднятие анкеты | 512 | // Поднятие анкеты |
516 | Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up'); | 513 | Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up'); |
517 | 514 | ||
518 | // Добавление сертификата | 515 | // Добавление сертификата |
519 | Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate'); | 516 | Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate'); |
520 | Route::get('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate'); | 517 | Route::get('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate'); |
521 | Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate'); | 518 | Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate'); |
522 | Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate'); | 519 | Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate'); |
523 | Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate'); | 520 | Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate'); |
524 | 521 | ||
525 | // Добавление предыдущих контактов компании | 522 | // Добавление предыдущих контактов компании |
526 | Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company'); | 523 | Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company'); |
527 | Route::get('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company'); | 524 | Route::get('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company'); |
528 | Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company'); | 525 | Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company'); |
529 | 526 | ||
530 | // Добавление документа-диплома | 527 | // Добавление документа-диплома |
531 | Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom'); | 528 | Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom'); |
532 | Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save'); | 529 | Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save'); |
533 | Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom'); | 530 | Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom'); |
534 | 531 | ||
535 | // Добавление стандартного диплома | 532 | // Добавление стандартного диплома |
536 | Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document'); | 533 | Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document'); |
537 | Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save'); | 534 | Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save'); |
538 | Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document'); | 535 | Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document'); |
539 | Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save'); | 536 | Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save'); |
540 | Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document'); | 537 | Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document'); |
541 | 538 | ||
542 | // Отправка сообщения работодателю от соискателя | 539 | // Отправка сообщения работодателю от соискателя |
543 | Route::post('сообщение/', [WorkerController::class, 'new_message'])->name('new_message'); | 540 | Route::post('сообщение/', [WorkerController::class, 'new_message'])->name('new_message'); |
544 | }); | 541 | }); |
545 | 542 | ||
546 | // Личный кабинет работодателя | 543 | // Личный кабинет работодателя |
547 | Route::group([ | 544 | Route::group([ |
548 | 'as' => 'employer.', // имя маршрута, например auth.index | 545 | 'as' => 'employer.', // имя маршрута, например auth.index |
549 | 'prefix' => 'employer', // префикс маршрута, например auth/index | 546 | 'prefix' => 'employer', // префикс маршрута, например auth/index |
550 | 'middleware' => ['auth'], !['is_worker'], | 547 | 'middleware' => ['auth'], !['is_worker'], |
551 | ], function() { | 548 | ], function() { |
549 | // 0 страница - Личные данные работодателя | ||
550 | Route::get('cabinet/employer_info', [EmployerController::class, 'employer_info'])->name('employer_info'); | ||
551 | Route::post('cabinet/employer_info/{user}', [EmployerController::class, 'employer_info_save'])->name('employer_info_save'); | ||
552 | |||
552 | // 1 страница - Профиль | 553 | // 1 страница - Профиль |
553 | Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet'); | 554 | Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet'); |
554 | Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save'); | 555 | Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save'); |
555 | Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot'); | 556 | Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot'); |
556 | Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot'); | 557 | Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot'); |
557 | Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot'); | 558 | Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot'); |
558 | 559 | ||
559 | // 2 страница - Добавление вакансий | 560 | // 2 страница - Добавление вакансий |
560 | Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie'); | 561 | Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie'); |
561 | Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save'); | 562 | Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save'); |
562 | 563 | ||
563 | |||
564 | Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); | 564 | Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); |
565 | 565 | ||
566 | |||
567 | // 3 страница - Мои вакансии | 566 | // 3 страница - Мои вакансии |
568 | Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list'); | 567 | Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list'); |
569 | Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); | 568 | Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); |
570 | Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete'); | 569 | Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete'); |
571 | Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up'); | 570 | Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up'); |
572 | Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye'); | 571 | Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye'); |
573 | Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); | 572 | Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); |
574 | Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); | 573 | Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); |
575 | 574 | ||
576 | // 4.1Ю. | 575 | // 4.1Ю. |
577 | Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac'); | 576 | Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac'); |
578 | Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save'); | 577 | Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save'); |
579 | Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac'); | 578 | Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac'); |
580 | Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save'); | 579 | Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save'); |
581 | Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac'); | 580 | Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac'); |
582 | 581 | ||
583 | // 4 страница - Отклики на вакансии | 582 | // 4 страница - Отклики на вакансии |
584 | Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers'); | 583 | Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers'); |
585 | Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple'); | 584 | Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple'); |
586 | Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg'); | 585 | Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg'); |
587 | 586 | ||
588 | // 5 страница - Сообщения | 587 | // 5 страница - Сообщения |
589 | Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages'); | 588 | Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages'); |
590 | Route::get('cabinet/dialog/{user1}/{user2}', [EmployerController::class, 'dialog'])->name('dialog'); | 589 | Route::get('cabinet/dialog/{user1}/{user2}', [EmployerController::class, 'dialog'])->name('dialog'); |
591 | Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message'); | 590 | Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message'); |
592 | Route::post('test123', [EmployerController::class, 'test123'])->name('test123'); | 591 | Route::post('test123', [EmployerController::class, 'test123'])->name('test123'); |
593 | 592 | ||
594 | // 6 страница - Избранный | 593 | // 6 страница - Избранный |
595 | Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites'); | 594 | Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites'); |
596 | 595 | ||
597 | //7 страница - База данных | 596 | //7 страница - База данных |
598 | Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd'); | 597 | Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd'); |
599 | 598 | ||
600 | //8 страница - База резюме | 599 | //8 страница - База резюме |
601 | Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe'); | 600 | Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe'); |
602 | 601 | ||
603 | // 9 рассылка сообщений | 602 | // 9 рассылка сообщений |
604 | Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages'); | 603 | Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages'); |
605 | Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post'); | 604 | Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post'); |
606 | 605 | ||
607 | // 10 страница FAQ вопросы | 606 | // 10 страница FAQ вопросы |
608 | Route::get('cabinet/faq', [EmployerController::class, 'faq'])->name('faq'); | 607 | Route::get('cabinet/faq', [EmployerController::class, 'faq'])->name('faq'); |
609 | 608 | ||
610 | // 11 страница - Настройка уведомлений | 609 | // 11 страница - Настройка уведомлений |
611 | Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe'); | 610 | Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe'); |
612 | Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe'); | 611 | Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe'); |
613 | 612 | ||
614 | // 12 страница - Сменить пароль | 613 | // 12 страница - Сменить пароль |
615 | Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset'); | 614 | Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset'); |
616 | Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password'); | 615 | Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password'); |
617 | 616 | ||
618 | // 13 страница - Удаление профиля | 617 | // 13 страница - Удаление профиля |
619 | Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people'); | 618 | Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people'); |
620 | Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user'); | 619 | Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user'); |
621 | Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user'); | 620 | Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user'); |
622 | 621 | ||
623 | // Отправил сообщение | 622 | // Отправил сообщение |
624 | Route::post('сообщение/', [EmployerController::class, 'new_message'])->name('new_message'); | 623 | Route::post('сообщение/', [EmployerController::class, 'new_message'])->name('new_message'); |
625 | }); | 624 | }); |