Commit 330dc3881004c08dedb59dd449c1ad0fba517aad
1 parent
3ea0de9fd7
Exists in
master
and in
1 other branch
Коммит обновление от четверга 6 июня
Showing 7 changed files with 44 additions and 13 deletions Inline Diff
app/Http/Controllers/EmployerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\BaseUser_min_Request; | 7 | use App\Http\Requests\BaseUser_min_Request; |
8 | use App\Http\Requests\BaseUserRequest; | 8 | use App\Http\Requests\BaseUserRequest; |
9 | use App\Http\Requests\FlotRequest; | 9 | use App\Http\Requests\FlotRequest; |
10 | use App\Http\Requests\MessagesRequiest; | 10 | use App\Http\Requests\MessagesRequiest; |
11 | use App\Http\Requests\VacancyRequestEdit; | 11 | use App\Http\Requests\VacancyRequestEdit; |
12 | use App\Http\Requests\VacansiaRequiest; | 12 | use App\Http\Requests\VacansiaRequiest; |
13 | use App\Mail\MailAdminy; | 13 | use App\Mail\MailAdminy; |
14 | use App\Mail\MailCreateEmployer; | 14 | use App\Mail\MailCreateEmployer; |
15 | use App\Mail\MailSotrudnichestvo; | 15 | use App\Mail\MailSotrudnichestvo; |
16 | use App\Mail\SendAllMessages; | 16 | use App\Mail\SendAllMessages; |
17 | use App\Models\Ad_employer; | 17 | use App\Models\Ad_employer; |
18 | use App\Models\Ad_jobs; | 18 | use App\Models\Ad_jobs; |
19 | use App\Models\ad_response; | 19 | use App\Models\ad_response; |
20 | use App\Models\Category; | 20 | use App\Models\Category; |
21 | use App\Models\Education; | 21 | use App\Models\Education; |
22 | use App\Models\Employer; | 22 | use App\Models\Employer; |
23 | use App\Models\employers_main; | 23 | use App\Models\employers_main; |
24 | use App\Models\Flot; | 24 | use App\Models\Flot; |
25 | use App\Models\Job_title; | 25 | use App\Models\Job_title; |
26 | use App\Models\Like_vacancy; | 26 | use App\Models\Like_vacancy; |
27 | use App\Models\Like_worker; | 27 | use App\Models\Like_worker; |
28 | use App\Models\Message; | 28 | use App\Models\Message; |
29 | use App\Models\Positions; | 29 | use App\Models\Positions; |
30 | use App\Models\Worker; | 30 | use App\Models\Worker; |
31 | use Carbon\Carbon; | 31 | use Carbon\Carbon; |
32 | use Illuminate\Auth\Events\Registered; | 32 | use Illuminate\Auth\Events\Registered; |
33 | use Illuminate\Database\Eloquent\Builder; | 33 | use Illuminate\Database\Eloquent\Builder; |
34 | use Illuminate\Database\Eloquent\Model; | 34 | use Illuminate\Database\Eloquent\Model; |
35 | use Illuminate\Foundation\Auth\User; | 35 | use Illuminate\Foundation\Auth\User; |
36 | use Illuminate\Http\Request; | 36 | use Illuminate\Http\Request; |
37 | use Illuminate\Support\Facades\Auth; | 37 | use Illuminate\Support\Facades\Auth; |
38 | use Illuminate\Support\Facades\Hash; | 38 | use Illuminate\Support\Facades\Hash; |
39 | use Illuminate\Support\Facades\Mail; | 39 | use Illuminate\Support\Facades\Mail; |
40 | use Illuminate\Support\Facades\Storage; | 40 | use Illuminate\Support\Facades\Storage; |
41 | use App\Models\User as User_Model; | 41 | use App\Models\User as User_Model; |
42 | use Illuminate\Support\Facades\Validator; | 42 | use Illuminate\Support\Facades\Validator; |
43 | 43 | ||
44 | class EmployerController extends Controller | 44 | class EmployerController extends Controller |
45 | { | 45 | { |
46 | public function vacancie($vacancy, Request $request) { | 46 | public function vacancie($vacancy, Request $request) { |
47 | $title = 'Заголовок вакансии'; | 47 | $title = 'Заголовок вакансии'; |
48 | $Query = Ad_employer::with('jobs')-> | 48 | $Query = Ad_employer::with('jobs')-> |
49 | with('cat')-> | 49 | with('cat')-> |
50 | with('employer')-> | 50 | with('employer')-> |
51 | with('jobs_code')-> | 51 | with('jobs_code')-> |
52 | select('ad_employers.*')-> | 52 | select('ad_employers.*')-> |
53 | where('id', '=', $vacancy)->get(); | 53 | where('id', '=', $vacancy)->get(); |
54 | 54 | ||
55 | if (isset(Auth()->user()->id)) | 55 | if (isset(Auth()->user()->id)) |
56 | $uid = Auth()->user()->id; | 56 | $uid = Auth()->user()->id; |
57 | else | 57 | else |
58 | $uid = 0; | 58 | $uid = 0; |
59 | $title = $Query[0]->name; | 59 | $title = $Query[0]->name; |
60 | if ($request->ajax()) { | 60 | if ($request->ajax()) { |
61 | return view('ajax.vacance-item', compact('Query','uid')); | 61 | return view('ajax.vacance-item', compact('Query','uid')); |
62 | } else { | 62 | } else { |
63 | return view('vacance-item', compact('title', 'Query', 'uid')); | 63 | return view('vacance-item', compact('title', 'Query', 'uid')); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | public function logout() { | 67 | public function logout() { |
68 | Auth::logout(); | 68 | Auth::logout(); |
69 | return redirect()->route('index') | 69 | return redirect()->route('index') |
70 | ->with('success', 'Вы вышли из личного кабинета'); | 70 | ->with('success', 'Вы вышли из личного кабинета'); |
71 | } | 71 | } |
72 | 72 | ||
73 | public function employer_info() { | 73 | public function employer_info() { |
74 | // код юзера | 74 | // код юзера |
75 | $user_info = Auth()->user(); | 75 | $user_info = Auth()->user(); |
76 | // вьюшка для вывода данных | 76 | // вьюшка для вывода данных |
77 | return view('employers.info', compact('user_info')); | 77 | return view('employers.info', compact('user_info')); |
78 | } | 78 | } |
79 | 79 | ||
80 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { | 80 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { |
81 | // Все данные через реквест | 81 | // Все данные через реквест |
82 | $all = $request->all(); | 82 | $all = $request->all(); |
83 | unset($all['_token']); | 83 | unset($all['_token']); |
84 | // обновление | 84 | // обновление |
85 | $user->update($all); | 85 | $user->update($all); |
86 | return redirect()->route('employer.employer_info'); | 86 | return redirect()->route('employer.employer_info'); |
87 | } | 87 | } |
88 | 88 | ||
89 | public function cabinet() { | 89 | public function cabinet() { |
90 | $id = Auth()->user()->id; | 90 | $id = Auth()->user()->id; |
91 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 91 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
92 | WhereHas('users', | 92 | WhereHas('users', |
93 | function (Builder $query) use ($id) {$query->Where('id', $id); | 93 | function (Builder $query) use ($id) {$query->Where('id', $id); |
94 | })->get(); | 94 | })->get(); |
95 | return view('employers.cabinet45', compact('Employer')); | 95 | return view('employers.cabinet45', compact('Employer')); |
96 | } | 96 | } |
97 | 97 | ||
98 | public function slider_flot() { | 98 | public function slider_flot() { |
99 | $id = Auth()->user()->id; | 99 | $id = Auth()->user()->id; |
100 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 100 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
101 | WhereHas('users', | 101 | WhereHas('users', |
102 | function (Builder $query) use ($id) {$query->Where('id', $id); | 102 | function (Builder $query) use ($id) {$query->Where('id', $id); |
103 | })->get(); | 103 | })->get(); |
104 | return view('employers.fly-flot', compact('Employer')); | 104 | return view('employers.fly-flot', compact('Employer')); |
105 | } | 105 | } |
106 | 106 | ||
107 | public function cabinet_save(Employer $Employer, Request $request) { | 107 | public function cabinet_save(Employer $Employer, Request $request) { |
108 | $params = $request->all(); | 108 | $params = $request->all(); |
109 | $params['user_id'] = Auth()->user()->id; | 109 | $params['user_id'] = Auth()->user()->id; |
110 | $id = $Employer->id; | 110 | $id = $Employer->id; |
111 | 111 | ||
112 | if ($request->has('logo')) { | 112 | if ($request->has('logo')) { |
113 | if (!empty($Employer->logo)) { | 113 | if (!empty($Employer->logo)) { |
114 | Storage::delete($Employer->logo); | 114 | Storage::delete($Employer->logo); |
115 | } | 115 | } |
116 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); | 116 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); |
117 | } | 117 | } |
118 | 118 | ||
119 | $Employer->update($params); | 119 | $Employer->update($params); |
120 | 120 | ||
121 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); | 121 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); |
122 | } | 122 | } |
123 | 123 | ||
124 | public function save_add_flot(FlotRequest $request) { | 124 | public function save_add_flot(FlotRequest $request) { |
125 | // отмена | 125 | // отмена |
126 | $params = $request->all(); | 126 | $params = $request->all(); |
127 | 127 | ||
128 | if ($request->has('image')) { | 128 | if ($request->has('image')) { |
129 | $params['image'] = $request->file('image')->store("flot", 'public'); | 129 | $params['image'] = $request->file('image')->store("flot", 'public'); |
130 | } | 130 | } |
131 | Flot::create($params); | 131 | Flot::create($params); |
132 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); | 132 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); |
133 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 133 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
134 | } | 134 | } |
135 | 135 | ||
136 | public function edit_flot(Flot $Flot, Employer $Employer) { | 136 | public function edit_flot(Flot $Flot, Employer $Employer) { |
137 | return view('employers.edit-flot', compact('Flot', 'Employer')); | 137 | return view('employers.edit-flot', compact('Flot', 'Employer')); |
138 | } | 138 | } |
139 | 139 | ||
140 | public function update_flot(FlotRequest $request, Flot $Flot) { | 140 | public function update_flot(FlotRequest $request, Flot $Flot) { |
141 | $params = $request->all(); | 141 | $params = $request->all(); |
142 | 142 | ||
143 | if ($request->has('image')) { | 143 | if ($request->has('image')) { |
144 | if (!empty($flot->image)) { | 144 | if (!empty($flot->image)) { |
145 | Storage::delete($flot->image); | 145 | Storage::delete($flot->image); |
146 | } | 146 | } |
147 | $params['image'] = $request->file('image')->store("flot", 'public'); | 147 | $params['image'] = $request->file('image')->store("flot", 'public'); |
148 | } else { | 148 | } else { |
149 | if (!empty($flot->image)) $params['image'] = $flot->image; | 149 | if (!empty($flot->image)) $params['image'] = $flot->image; |
150 | } | 150 | } |
151 | 151 | ||
152 | $Flot->update($params); | 152 | $Flot->update($params); |
153 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 153 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
154 | } | 154 | } |
155 | 155 | ||
156 | public function delete_flot(Flot $Flot) { | 156 | public function delete_flot(Flot $Flot) { |
157 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); | 157 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); |
158 | 158 | ||
159 | if (isset($Flot->id)) $Flot->delete(); | 159 | if (isset($Flot->id)) $Flot->delete(); |
160 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); | 160 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); |
161 | } | 161 | } |
162 | 162 | ||
163 | // Форма добавления вакансий | 163 | // Форма добавления вакансий |
164 | public function cabinet_vacancie() { | 164 | public function cabinet_vacancie() { |
165 | $id = Auth()->user()->id; | 165 | $id = Auth()->user()->id; |
166 | 166 | ||
167 | if (Auth()->user()->is_public) { | 167 | if (Auth()->user()->is_public) { |
168 | $categories = Category::query()->active()->get(); | 168 | $categories = Category::query()->active()->get(); |
169 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 169 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
170 | where('is_remove', '=', '0')-> | 170 | where('is_remove', '=', '0')-> |
171 | where('is_bd', '=', '0')-> | 171 | where('is_bd', '=', '0')-> |
172 | get(); | 172 | get(); |
173 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 173 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
174 | WhereHas('users', | 174 | WhereHas('users', |
175 | function (Builder $query) use ($id) { | 175 | function (Builder $query) use ($id) { |
176 | $query->Where('id', $id); | 176 | $query->Where('id', $id); |
177 | })->get(); | 177 | })->get(); |
178 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); | 178 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); |
179 | } else { | 179 | } else { |
180 | return redirect()->route('employer.cabinet_vacancie_danger'); | 180 | return redirect()->route('employer.cabinet_vacancie_danger'); |
181 | } | 181 | } |
182 | } | 182 | } |
183 | 183 | ||
184 | // Форма предупреждения об оплате | 184 | // Форма предупреждения об оплате |
185 | public function cabinet_vacancie_danger() { | 185 | public function cabinet_vacancie_danger() { |
186 | return view('employers.add_vacancy_danger'); | 186 | return view('employers.add_vacancy_danger'); |
187 | } | 187 | } |
188 | 188 | ||
189 | // Сохранение вакансии | 189 | // Сохранение вакансии |
190 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { | 190 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { |
191 | $params_emp = $request->all(); | 191 | $params_emp = $request->all(); |
192 | 192 | ||
193 | $params_job["job_title_id"] = $params_emp['job_title_id']; | 193 | $params_job["job_title_id"] = $params_emp['job_title_id']; |
194 | //$params_job["min_salary"] = $params_emp['min_salary']; | 194 | //$params_job["min_salary"] = $params_emp['min_salary']; |
195 | //$params_job["max_salary"] = $params_emp['max_salary']; | 195 | //$params_job["max_salary"] = $params_emp['max_salary']; |
196 | //$params_job["region"] = $params_emp['region']; | 196 | //$params_job["region"] = $params_emp['region']; |
197 | //$params_job["power"] = $params_emp['power']; | 197 | //$params_job["power"] = $params_emp['power']; |
198 | //$params_job["sytki"] = $params_emp['sytki']; | 198 | //$params_job["sytki"] = $params_emp['sytki']; |
199 | //$params_job["start"] = $params_emp['start']; | 199 | //$params_job["start"] = $params_emp['start']; |
200 | //$params_job["flot"] = $params_emp['flot']; | 200 | //$params_job["flot"] = $params_emp['flot']; |
201 | //$params_job["description"] = $params_emp['description']; | 201 | //$params_job["description"] = $params_emp['description']; |
202 | 202 | ||
203 | $ad_jobs = Ad_employer::create($params_emp); | 203 | $ad_jobs = Ad_employer::create($params_emp); |
204 | //$params_job['ad_employer_id'] = $ad_jobs->id; | 204 | //$params_job['ad_employer_id'] = $ad_jobs->id; |
205 | //Ad_jobs::create($params_job); | 205 | //Ad_jobs::create($params_job); |
206 | $ad_jobs->jobs()->sync($request->get('job_title_id')); | 206 | $ad_jobs->jobs()->sync($request->get('job_title_id')); |
207 | 207 | ||
208 | return redirect()->route('employer.vacancy_list'); | 208 | return redirect()->route('employer.vacancy_list'); |
209 | } | 209 | } |
210 | 210 | ||
211 | // Список вакансий | 211 | // Список вакансий |
212 | public function vacancy_list(Request $request) { | 212 | public function vacancy_list(Request $request) { |
213 | $id = Auth()->user()->id; | 213 | $id = Auth()->user()->id; |
214 | 214 | ||
215 | //dd($request->all()); | 215 | //dd($request->all()); |
216 | $Employer = Employer::query()->where('user_id', $id)->first(); | 216 | $Employer = Employer::query()->where('user_id', $id)->first(); |
217 | $vacancy_list = Ad_employer::query()->with('jobs')-> | 217 | $vacancy_list = Ad_employer::query()->with('jobs')-> |
218 | with('jobs_code')-> | 218 | with('jobs_code')-> |
219 | where('employer_id', $Employer->id); | 219 | where('employer_id', $Employer->id); |
220 | 220 | ||
221 | if (($request->has('search')) && (!empty($request->get('search')))) { | 221 | if (($request->has('search')) && (!empty($request->get('search')))) { |
222 | $search = $request->get('search'); | 222 | $search = $request->get('search'); |
223 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); | 223 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); |
224 | } | 224 | } |
225 | 225 | ||
226 | if ($request->get('sort')) { | 226 | if ($request->get('sort')) { |
227 | $sort = $request->get('sort'); | 227 | $sort = $request->get('sort'); |
228 | switch ($sort) { | 228 | switch ($sort) { |
229 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; | 229 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; |
230 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; | 230 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; |
231 | case 'nopublic': $vacancy_list = $vacancy_list->OrderBy('active_is')->orderBy('id'); break; | 231 | case 'nopublic': $vacancy_list = $vacancy_list->OrderBy('active_is')->orderBy('id'); break; |
232 | case 'public': $vacancy_list = $vacancy_list->OrderByDesc('active_is')->orderBy('id'); break; | 232 | case 'public': $vacancy_list = $vacancy_list->OrderByDesc('active_is')->orderBy('id'); break; |
233 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; | 233 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; |
234 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; | 234 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; |
235 | case 'default': $vacancy_list = $vacancy_list->orderbyDesc('updated_at')->orderBy('name'); break; | 235 | case 'default': $vacancy_list = $vacancy_list->orderbyDesc('updated_at')->orderBy('name'); break; |
236 | default: $vacancy_list = $vacancy_list->orderByDesc('id')->orderbyDesc('updated_at'); break; | 236 | default: $vacancy_list = $vacancy_list->orderByDesc('id')->orderbyDesc('updated_at'); break; |
237 | } | 237 | } |
238 | } | 238 | } |
239 | $vacancy_list = $vacancy_list->paginate(4); | 239 | $vacancy_list = $vacancy_list->paginate(4); |
240 | 240 | ||
241 | //ajax | 241 | //ajax |
242 | if ($request->ajax()) { | 242 | if ($request->ajax()) { |
243 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); | 243 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); |
244 | } else { | 244 | } else { |
245 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); | 245 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | // Карточка вакансии | 249 | // Карточка вакансии |
250 | public function vacancy_edit(Ad_employer $ad_employer) { | 250 | public function vacancy_edit(Ad_employer $ad_employer) { |
251 | $id = Auth()->user()->id; | 251 | $id = Auth()->user()->id; |
252 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 252 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
253 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 253 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
254 | where('is_remove', '=', '0')-> | 254 | where('is_remove', '=', '0')-> |
255 | where('is_bd', '=', '0')->get(); | 255 | where('is_bd', '=', '0')->get(); |
256 | 256 | ||
257 | $Employer = Employer::query()->with('users')->with('ads')-> | 257 | $Employer = Employer::query()->with('users')->with('ads')-> |
258 | with('flots')->where('user_id', $id)->first(); | 258 | with('flots')->where('user_id', $id)->first(); |
259 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 259 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
260 | } | 260 | } |
261 | 261 | ||
262 | // Сохранение-редактирование записи | 262 | // Сохранение-редактирование записи |
263 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { | 263 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { |
264 | $params = $request->all(); | 264 | $params = $request->all(); |
265 | $params_job["job_title_id"] = $params['job_title_id']; | 265 | $params_job["job_title_id"] = $params['job_title_id']; |
266 | 266 | ||
267 | //$jobs['flot'] = $params['flot']; | 267 | //$jobs['flot'] = $params['flot']; |
268 | //$jobs['job_title_id'] = $params['job_title_id']; | 268 | //$jobs['job_title_id'] = $params['job_title_id']; |
269 | //$titles['position_id'] = $params['position_id']; | 269 | //$titles['position_id'] = $params['position_id']; |
270 | //unset($params['job_title_id']); | 270 | //unset($params['job_title_id']); |
271 | //dd($params); | 271 | //dd($params); |
272 | $ad_employer->update($params); | 272 | $ad_employer->update($params); |
273 | $ad_employer->jobs()->sync($request->get('job_title_id')); | 273 | $ad_employer->jobs()->sync($request->get('job_title_id')); |
274 | 274 | ||
275 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> | 275 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> |
276 | // where('ad_employer_id', $ad_employer->id)->first(); | 276 | // where('ad_employer_id', $ad_employer->id)->first(); |
277 | //$data = Ad_jobs::find($job_->id); | 277 | //$data = Ad_jobs::find($job_->id); |
278 | //$ad_jobs = $data->update($jobs); | 278 | //$ad_jobs = $data->update($jobs); |
279 | 279 | ||
280 | return redirect()->route('employer.vacancy_list'); | 280 | return redirect()->route('employer.vacancy_list'); |
281 | } | 281 | } |
282 | 282 | ||
283 | // Сохранение карточки вакансии | 283 | // Сохранение карточки вакансии |
284 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { | 284 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { |
285 | $all = $request->all(); | 285 | $all = $request->all(); |
286 | $ad_employer->update($all); | 286 | $ad_employer->update($all); |
287 | return redirect()->route('employer.cabinet_vacancie'); | 287 | return redirect()->route('employer.cabinet_vacancie'); |
288 | } | 288 | } |
289 | 289 | ||
290 | // Удаление карточки вакансии | 290 | // Удаление карточки вакансии |
291 | public function vacancy_delete(Ad_employer $ad_employer) { | 291 | public function vacancy_delete(Ad_employer $ad_employer) { |
292 | $ad_employer->delete(); | 292 | $ad_employer->delete(); |
293 | 293 | ||
294 | return redirect()->route('employer.vacancy_list') | 294 | return redirect()->route('employer.vacancy_list') |
295 | ->with('success', 'Данные были успешно сохранены'); | 295 | ->with('success', 'Данные были успешно сохранены'); |
296 | } | 296 | } |
297 | 297 | ||
298 | // Обновление даты | 298 | // Обновление даты |
299 | public function vacancy_up(Ad_employer $ad_employer) { | 299 | public function vacancy_up(Ad_employer $ad_employer) { |
300 | $up = date('m/d/Y h:i:s', time());; | 300 | $up = date('m/d/Y h:i:s', time());; |
301 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 301 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
302 | $vac_emp->updated_at = $up; | 302 | $vac_emp->updated_at = $up; |
303 | $vac_emp->save(); | 303 | $vac_emp->save(); |
304 | 304 | ||
305 | return redirect()->route('employer.vacancy_list'); | 305 | return redirect()->back(); //route('employer.vacancy_list'); |
306 | // начало конца | 306 | // начало конца |
307 | } | 307 | } |
308 | 308 | ||
309 | //Видимость вакансии | 309 | //Видимость вакансии |
310 | public function vacancy_eye(Ad_employer $ad_employer, $status) { | 310 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
311 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 311 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
312 | $vac_emp->active_is = $status; | 312 | $vac_emp->active_is = $status; |
313 | $vac_emp->save(); | 313 | $vac_emp->save(); |
314 | 314 | ||
315 | return redirect()->route('employer.vacancy_list'); | 315 | return redirect()->route('employer.vacancy_list'); |
316 | } | 316 | } |
317 | 317 | ||
318 | //Вакансия редактирования (шаблон) | 318 | //Вакансия редактирования (шаблон) |
319 | public function vacancy_update(Ad_employer $id) { | 319 | public function vacancy_update(Ad_employer $id) { |
320 | 320 | ||
321 | } | 321 | } |
322 | 322 | ||
323 | //Отклики на вакансию - лист | 323 | //Отклики на вакансию - лист |
324 | public function answers(Employer $employer, Request $request) { | 324 | public function answers(Employer $employer, Request $request) { |
325 | $user_id = Auth()->user()->id; | 325 | $user_id = Auth()->user()->id; |
326 | $answer = Ad_employer::query()->where('employer_id', $employer->id); | 326 | $answer = Ad_employer::query()->where('employer_id', $employer->id); |
327 | if ($request->has('search')) { | 327 | if ($request->has('search')) { |
328 | $search = trim($request->get('search')); | 328 | $search = trim($request->get('search')); |
329 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); | 329 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); |
330 | } | 330 | } |
331 | 331 | ||
332 | $answer = $answer->with('response')->OrderByDESC('id')->get(); | 332 | $answer = $answer->with('response')->OrderByDESC('id')->get(); |
333 | 333 | ||
334 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); | 334 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); |
335 | } | 335 | } |
336 | 336 | ||
337 | //Обновление статуса | 337 | //Обновление статуса |
338 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { | 338 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { |
339 | $ad_response->update(Array('flag' => $flag)); | 339 | $ad_response->update(Array('flag' => $flag)); |
340 | return redirect()->route('employer.answers', ['employer' => $employer->id]); | 340 | return redirect()->route('employer.answers', ['employer' => $employer->id]); |
341 | } | 341 | } |
342 | 342 | ||
343 | //Страницы сообщений список | 343 | //Страницы сообщений список |
344 | public function messages($type_message) { | 344 | public function messages($type_message) { |
345 | $user_id = Auth()->user()->id; | 345 | $user_id = Auth()->user()->id; |
346 | 346 | ||
347 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 347 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
348 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 348 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
349 | 349 | ||
350 | $messages_output = Message::query()->with('vacancies')-> | 350 | $messages_output = Message::query()->with('vacancies')-> |
351 | with('user_to')->where('user_id', $user_id)-> | 351 | with('user_to')->where('user_id', $user_id)-> |
352 | OrderByDesc('created_at'); | 352 | OrderByDesc('created_at'); |
353 | 353 | ||
354 | $count_input = $messages_input->count(); | 354 | $count_input = $messages_input->count(); |
355 | $count_output = $messages_output->count(); | 355 | $count_output = $messages_output->count(); |
356 | 356 | ||
357 | if ($type_message == 'input') { | 357 | if ($type_message == 'input') { |
358 | $messages = $messages_input->paginate(5); | 358 | $messages = $messages_input->paginate(5); |
359 | } | 359 | } |
360 | 360 | ||
361 | if ($type_message == 'output') { | 361 | if ($type_message == 'output') { |
362 | $messages = $messages_output->paginate(5); | 362 | $messages = $messages_output->paginate(5); |
363 | } | 363 | } |
364 | 364 | ||
365 | //dd($user_id, $messages[2]->vacancies); | 365 | //dd($user_id, $messages[2]->vacancies); |
366 | //jobs); | 366 | //jobs); |
367 | 367 | ||
368 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 368 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
369 | } | 369 | } |
370 | 370 | ||
371 | // Диалог между пользователями | 371 | // Диалог между пользователями |
372 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { | 372 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { |
373 | // Получение параметров. | 373 | // Получение параметров. |
374 | if ($request->has('ad_employer')){ | 374 | if ($request->has('ad_employer')){ |
375 | $ad_employer = $request->get('ad_employer'); | 375 | $ad_employer = $request->get('ad_employer'); |
376 | } else { | 376 | } else { |
377 | $ad_employer = 0; | 377 | $ad_employer = 0; |
378 | } | 378 | } |
379 | 379 | ||
380 | if (isset($user2->id)) { | 380 | if (isset($user2->id)) { |
381 | $companion = User_Model::query()->with('workers')-> | 381 | $companion = User_Model::query()->with('workers')-> |
382 | with('employers')-> | 382 | with('employers')-> |
383 | where('id', $user2->id)->first(); | 383 | where('id', $user2->id)->first(); |
384 | } | 384 | } |
385 | 385 | ||
386 | $Messages = Message::query()-> | 386 | $Messages = Message::query()-> |
387 | where('ad_employer_id', '=', $ad_employer)-> | 387 | where('ad_employer_id', '=', $ad_employer)-> |
388 | where(function($query) use ($user1, $user2) { | 388 | where(function($query) use ($user1, $user2) { |
389 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 389 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
390 | })->orWhere(function($query) use ($user1, $user2) { | 390 | })->orWhere(function($query) use ($user1, $user2) { |
391 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 391 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
392 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); | 392 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); |
393 | 393 | ||
394 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; | 394 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; |
395 | 395 | ||
396 | //$ad_employer = null; | 396 | //$ad_employer = null; |
397 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 397 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
398 | $sender = $user1; | 398 | $sender = $user1; |
399 | 399 | ||
400 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); | 400 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); |
401 | } | 401 | } |
402 | 402 | ||
403 | // Регистрация работодателя | 403 | // Регистрация работодателя |
404 | public function register_employer(Request $request) { | 404 | public function register_employer(Request $request) { |
405 | $params = $request->all(); | 405 | $params = $request->all(); |
406 | 406 | ||
407 | $rules = [ | 407 | $rules = [ |
408 | //'surname' => ['required', 'string', 'max:255'], | 408 | //'surname' => ['required', 'string', 'max:255'], |
409 | //'name_man' => ['required', 'string', 'max:255'], | 409 | //'name_man' => ['required', 'string', 'max:255'], |
410 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | 410 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
411 | 'name_company' => ['required', 'string', 'max:255'], | 411 | 'name_company' => ['required', 'string', 'max:255'], |
412 | 'password' => ['required', 'string', 'min:6'], | 412 | 'password' => ['required', 'string', 'min:6'], |
413 | ]; | 413 | ]; |
414 | 414 | ||
415 | 415 | ||
416 | $messages = [ | 416 | $messages = [ |
417 | 'required' => 'Укажите обязательное поле', | 417 | 'required' => 'Укажите обязательное поле', |
418 | 'min' => [ | 418 | 'min' => [ |
419 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 419 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
420 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 420 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
421 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 421 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
422 | ], | 422 | ], |
423 | 'max' => [ | 423 | 'max' => [ |
424 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 424 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
425 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 425 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
426 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 426 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
427 | ] | 427 | ] |
428 | ]; | 428 | ]; |
429 | 429 | ||
430 | $email = $request->get('email'); | 430 | $email = $request->get('email'); |
431 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 431 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
432 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 432 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
433 | } | 433 | } |
434 | 434 | ||
435 | if ($request->get('password') !== $request->get('confirmed')){ | 435 | if ($request->get('password') !== $request->get('confirmed')){ |
436 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 436 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
437 | } | 437 | } |
438 | 438 | ||
439 | if (strlen($request->get('password')) < 6) { | 439 | if (strlen($request->get('password')) < 6) { |
440 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 440 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
441 | } | 441 | } |
442 | /* | 442 | /* |
443 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 443 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
444 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 444 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
445 | 'X', 'C', 'V', 'B', 'N', 'M'); | 445 | 'X', 'C', 'V', 'B', 'N', 'M'); |
446 | $spec_bool = false; | 446 | $spec_bool = false; |
447 | $alpha_bool = false; | 447 | $alpha_bool = false; |
448 | 448 | ||
449 | $haystack = $request->get('password'); | 449 | $haystack = $request->get('password'); |
450 | 450 | ||
451 | foreach ($specsumbol as $it) { | 451 | foreach ($specsumbol as $it) { |
452 | if (strpos($haystack, $it) !== false) { | 452 | if (strpos($haystack, $it) !== false) { |
453 | $spec_bool = true; | 453 | $spec_bool = true; |
454 | } | 454 | } |
455 | } | 455 | } |
456 | 456 | ||
457 | foreach ($alpha as $it) { | 457 | foreach ($alpha as $it) { |
458 | if (strpos($haystack, $it) !== false) { | 458 | if (strpos($haystack, $it) !== false) { |
459 | $alpha_bool = true; | 459 | $alpha_bool = true; |
460 | } | 460 | } |
461 | } | 461 | } |
462 | 462 | ||
463 | if ((!$spec_bool) || (!$alpha_bool)) { | 463 | if ((!$spec_bool) || (!$alpha_bool)) { |
464 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 464 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
465 | }*/ | 465 | }*/ |
466 | 466 | ||
467 | if (empty($request->get('surname'))) { | 467 | if (empty($request->get('surname'))) { |
468 | $params['surname'] = 'Неизвестно'; | 468 | $params['surname'] = 'Неизвестно'; |
469 | } | 469 | } |
470 | if (empty($request->get('name_man'))) { | 470 | if (empty($request->get('name_man'))) { |
471 | $params['name_man'] = 'Неизвестно'; | 471 | $params['name_man'] = 'Неизвестно'; |
472 | } | 472 | } |
473 | $validator = Validator::make($params, $rules, $messages); | 473 | $validator = Validator::make($params, $rules, $messages); |
474 | 474 | ||
475 | if ($validator->fails()) { | 475 | if ($validator->fails()) { |
476 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 476 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
477 | } else { | 477 | } else { |
478 | $user = $this->create($params); | 478 | $user = $this->create($params); |
479 | event(new Registered($user)); | 479 | event(new Registered($user)); |
480 | 480 | ||
481 | Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); | 481 | Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); |
482 | 482 | ||
483 | Auth::guard()->login($user); | 483 | Auth::guard()->login($user); |
484 | } | 484 | } |
485 | 485 | ||
486 | if ($user) { | 486 | if ($user) { |
487 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | 487 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; |
488 | } else { | 488 | } else { |
489 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 489 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
490 | } | 490 | } |
491 | } | 491 | } |
492 | 492 | ||
493 | // Создание пользователя | 493 | // Создание пользователя |
494 | protected function create(array $data) | 494 | protected function create(array $data) |
495 | { | 495 | { |
496 | $Use = new User_Model(); | 496 | $Use = new User_Model(); |
497 | $Code_user = $Use->create([ | 497 | $Code_user = $Use->create([ |
498 | 'name' => $data['surname']." ".$data['name_man'], | 498 | 'name' => $data['surname']." ".$data['name_man'], |
499 | 'name_man' => $data['name_man'], | 499 | 'name_man' => $data['name_man'], |
500 | 'surname' => $data['surname'], | 500 | 'surname' => $data['surname'], |
501 | 'surname2' => $data['surname2'], | 501 | 'surname2' => $data['surname2'], |
502 | 'subscribe_email' => $data['email'], | 502 | 'subscribe_email' => $data['email'], |
503 | 'email' => $data['email'], | 503 | 'email' => $data['email'], |
504 | 'telephone' => $data['telephone'], | 504 | 'telephone' => $data['telephone'], |
505 | 'is_worker' => 0, | 505 | 'is_worker' => 0, |
506 | 'password' => Hash::make($data['password']), | 506 | 'password' => Hash::make($data['password']), |
507 | 'pubpassword' => base64_encode($data['password']), | 507 | 'pubpassword' => base64_encode($data['password']), |
508 | 'email_verified_at' => Carbon::now() | 508 | 'email_verified_at' => Carbon::now() |
509 | ]); | 509 | ]); |
510 | 510 | ||
511 | if ($Code_user->id > 0) { | 511 | if ($Code_user->id > 0) { |
512 | $Employer = new Employer(); | 512 | $Employer = new Employer(); |
513 | $Employer->user_id = $Code_user->id; | 513 | $Employer->user_id = $Code_user->id; |
514 | $Employer->name_company = $data['name_company']; | 514 | $Employer->name_company = $data['name_company']; |
515 | $Employer->email = $data['email']; | 515 | $Employer->email = $data['email']; |
516 | $Employer->telephone = $data['telephone']; | 516 | $Employer->telephone = $data['telephone']; |
517 | $Employer->code = Tools::generator_id(10); | 517 | $Employer->code = Tools::generator_id(10); |
518 | $Employer->save(); | 518 | $Employer->save(); |
519 | 519 | ||
520 | return $Code_user; | 520 | return $Code_user; |
521 | } | 521 | } |
522 | } | 522 | } |
523 | 523 | ||
524 | // Отправка сообщения от работодателя | 524 | // Отправка сообщения от работодателя |
525 | public function send_message(MessagesRequiest $request) { | 525 | public function send_message(MessagesRequiest $request) { |
526 | $params = $request->all(); | 526 | $params = $request->all(); |
527 | dd($params); | 527 | dd($params); |
528 | $user1 = $params['user_id']; | 528 | $user1 = $params['user_id']; |
529 | $user2 = $params['to_user_id']; | 529 | $user2 = $params['to_user_id']; |
530 | 530 | ||
531 | if ($request->has('file')) { | 531 | if ($request->has('file')) { |
532 | $params['file'] = $request->file('file')->store("messages", 'public'); | 532 | $params['file'] = $request->file('file')->store("messages", 'public'); |
533 | } | 533 | } |
534 | Message::create($params); | 534 | Message::create($params); |
535 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 535 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
536 | } | 536 | } |
537 | 537 | ||
538 | public function test123(Request $request) { | 538 | public function test123(Request $request) { |
539 | $params = $request->all(); | 539 | $params = $request->all(); |
540 | $user1 = $params['user_id']; | 540 | $user1 = $params['user_id']; |
541 | $user2 = $params['to_user_id']; | 541 | $user2 = $params['to_user_id']; |
542 | $id_vacancy = $params['ad_employer_id']; | 542 | $id_vacancy = $params['ad_employer_id']; |
543 | $ad_name = $params['ad_name']; | 543 | $ad_name = $params['ad_name']; |
544 | 544 | ||
545 | $rules = [ | 545 | $rules = [ |
546 | 'text' => 'required|min:1|max:150000', | 546 | 'text' => 'required|min:1|max:150000', |
547 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 547 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
548 | ]; | 548 | ]; |
549 | $messages = [ | 549 | $messages = [ |
550 | 'required' => 'Укажите обязательное поле', | 550 | 'required' => 'Укажите обязательное поле', |
551 | 'min' => [ | 551 | 'min' => [ |
552 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 552 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
553 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 553 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
554 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 554 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
555 | ], | 555 | ], |
556 | 'max' => [ | 556 | 'max' => [ |
557 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 557 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
558 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 558 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
559 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 559 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
560 | ] | 560 | ] |
561 | ]; | 561 | ]; |
562 | 562 | ||
563 | $validator = Validator::make($request->all(), $rules, $messages); | 563 | $validator = Validator::make($request->all(), $rules, $messages); |
564 | 564 | ||
565 | if ($validator->fails()) { | 565 | if ($validator->fails()) { |
566 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) | 566 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) |
567 | ->withErrors($validator); | 567 | ->withErrors($validator); |
568 | } else { | 568 | } else { |
569 | if ($request->has('file')) { | 569 | if ($request->has('file')) { |
570 | $params['file'] = $request->file('file')->store("messages", 'public'); | 570 | $params['file'] = $request->file('file')->store("messages", 'public'); |
571 | } | 571 | } |
572 | Message::create($params); | 572 | Message::create($params); |
573 | //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 573 | //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
574 | return redirect()->route('employer.dialog', | 574 | return redirect()->route('employer.dialog', |
575 | ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); | 575 | ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); |
576 | 576 | ||
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | ||
580 | //Избранные люди | 580 | //Избранные люди |
581 | public function favorites(Request $request) { | 581 | public function favorites(Request $request) { |
582 | $IP_address = RusDate::ip_addr_client(); | 582 | $IP_address = RusDate::ip_addr_client(); |
583 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 583 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
584 | 584 | ||
585 | if ($Arr->count()) { | 585 | if ($Arr->count()) { |
586 | $A = Array(); | 586 | $A = Array(); |
587 | foreach ($Arr as $it) { | 587 | foreach ($Arr as $it) { |
588 | $A[] = $it->code_record; | 588 | $A[] = $it->code_record; |
589 | } | 589 | } |
590 | 590 | ||
591 | $Workers = Worker::query()->whereIn('id', $A); | 591 | $Workers = Worker::query()->whereIn('id', $A); |
592 | } else { | 592 | } else { |
593 | $Workers = Worker::query()->where('id', '=', '0'); | 593 | $Workers = Worker::query()->where('id', '=', '0'); |
594 | } | 594 | } |
595 | 595 | ||
596 | if (($request->has('search')) && (!empty($request->get('search')))) { | 596 | if (($request->has('search')) && (!empty($request->get('search')))) { |
597 | $search = $request->get('search'); | 597 | $search = $request->get('search'); |
598 | 598 | ||
599 | $Workers = $Workers->WhereHas('users', | 599 | $Workers = $Workers->WhereHas('users', |
600 | function (Builder $query) use ($search) { | 600 | function (Builder $query) use ($search) { |
601 | $query->Where('surname', 'LIKE', "%$search%") | 601 | $query->Where('surname', 'LIKE', "%$search%") |
602 | ->orWhere('name_man', 'LIKE', "%$search%") | 602 | ->orWhere('name_man', 'LIKE', "%$search%") |
603 | ->orWhere('surname2', 'LIKE', "%$search%"); | 603 | ->orWhere('surname2', 'LIKE', "%$search%"); |
604 | }); | 604 | }); |
605 | } else { | 605 | } else { |
606 | $Workers = $Workers->with('users'); | 606 | $Workers = $Workers->with('users'); |
607 | } | 607 | } |
608 | 608 | ||
609 | $Workers = $Workers->get(); | 609 | $Workers = $Workers->get(); |
610 | 610 | ||
611 | 611 | ||
612 | return view('employers.favorite', compact('Workers')); | 612 | return view('employers.favorite', compact('Workers')); |
613 | } | 613 | } |
614 | 614 | ||
615 | // База данных | 615 | // База данных |
616 | public function bd(Request $request) { | 616 | public function bd(Request $request) { |
617 | // для типа BelongsTo | 617 | // для типа BelongsTo |
618 | //$documents = Document::query()->orderBy(Location::select('name') | 618 | //$documents = Document::query()->orderBy(Location::select('name') |
619 | // ->whereColumn('locations.id', 'documents.location_id') | 619 | // ->whereColumn('locations.id', 'documents.location_id') |
620 | //); | 620 | //); |
621 | 621 | ||
622 | // для типа HasOne/Many | 622 | // для типа HasOne/Many |
623 | // $documents = Document::::query()->orderBy(Location::select('name') | 623 | // $documents = Document::::query()->orderBy(Location::select('name') |
624 | // ->whereColumn('locations.document_id', 'documents.id') | 624 | // ->whereColumn('locations.document_id', 'documents.id') |
625 | //); | 625 | //); |
626 | 626 | ||
627 | 627 | ||
628 | $users = User_Model::query()->with('workers'); | 628 | $users = User_Model::query()->with('workers'); |
629 | 629 | ||
630 | if ($request->has('search')) { | 630 | if ($request->has('search')) { |
631 | $find_key = $request->get('search'); | 631 | $find_key = $request->get('search'); |
632 | $users = $users->where('name', 'LIKE', "%$find_key%") | 632 | $users = $users->where('name', 'LIKE', "%$find_key%") |
633 | ->orWhere('surname', 'LIKE', "%$find_key%") | 633 | ->orWhere('surname', 'LIKE', "%$find_key%") |
634 | ->orWhere('name_man', 'LIKE', "%$find_key%") | 634 | ->orWhere('name_man', 'LIKE', "%$find_key%") |
635 | ->orWhere('email', 'LIKE', "%$find_key%") | 635 | ->orWhere('email', 'LIKE', "%$find_key%") |
636 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 636 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
637 | } | 637 | } |
638 | 638 | ||
639 | // Данные | 639 | // Данные |
640 | $users = $users->Baseuser()-> | 640 | $users = $users->Baseuser()-> |
641 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); | 641 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); |
642 | $count_users = $users; | 642 | $count_users = $users; |
643 | $users = $users->paginate(5); | 643 | $users = $users->paginate(5); |
644 | 644 | ||
645 | 645 | ||
646 | return view('employers.bd', compact('users', 'count_users')); | 646 | return view('employers.bd', compact('users', 'count_users')); |
647 | } | 647 | } |
648 | 648 | ||
649 | //Настройка уведомлений | 649 | //Настройка уведомлений |
650 | public function subscribe() { | 650 | public function subscribe() { |
651 | return view('employers.subcribe'); | 651 | return view('employers.subcribe'); |
652 | } | 652 | } |
653 | 653 | ||
654 | //Установка уведомлений сохранение | 654 | //Установка уведомлений сохранение |
655 | public function save_subscribe(Request $request) { | 655 | public function save_subscribe(Request $request) { |
656 | dd($request->all()); | 656 | dd($request->all()); |
657 | $msg = $request->validate([ | 657 | $msg = $request->validate([ |
658 | 'subscribe_email' => 'required|email|min:5|max:255', | 658 | 'subscribe_email' => 'required|email|min:5|max:255', |
659 | ]); | 659 | ]); |
660 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); | 660 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); |
661 | } | 661 | } |
662 | 662 | ||
663 | //Сбросить форму с паролем | 663 | //Сбросить форму с паролем |
664 | public function password_reset() { | 664 | public function password_reset() { |
665 | $email = Auth()->user()->email; | 665 | $email = Auth()->user()->email; |
666 | return view('employers.password-reset', compact('email')); | 666 | return view('employers.password-reset', compact('email')); |
667 | } | 667 | } |
668 | 668 | ||
669 | //Обновление пароля | 669 | //Обновление пароля |
670 | public function new_password(Request $request) { | 670 | public function new_password(Request $request) { |
671 | $use = Auth()->user(); | 671 | $use = Auth()->user(); |
672 | $request->validate([ | 672 | $request->validate([ |
673 | 'password' => 'required|string', | 673 | 'password' => 'required|string', |
674 | 'new_password' => 'required|string', | 674 | 'new_password' => 'required|string', |
675 | 'new_password2' => 'required|string' | 675 | 'new_password2' => 'required|string' |
676 | ]); | 676 | ]); |
677 | 677 | ||
678 | if ($request->get('new_password') == $request->get('new_password2')) | 678 | if ($request->get('new_password') == $request->get('new_password2')) |
679 | if ($request->get('password') !== $request->get('new_password')) { | 679 | if ($request->get('password') !== $request->get('new_password')) { |
680 | $credentials = $request->only('email', 'password'); | 680 | $credentials = $request->only('email', 'password'); |
681 | if (Auth::attempt($credentials)) { | 681 | if (Auth::attempt($credentials)) { |
682 | 682 | ||
683 | if (!is_null($use->email_verified_at)){ | 683 | if (!is_null($use->email_verified_at)){ |
684 | 684 | ||
685 | $user_data = User_Model::find($use->id); | 685 | $user_data = User_Model::find($use->id); |
686 | $user_data->update([ | 686 | $user_data->update([ |
687 | 'password' => Hash::make($request->get('new_password')), | 687 | 'password' => Hash::make($request->get('new_password')), |
688 | 'pubpassword' => base64_encode($request->get('new_password')), | 688 | 'pubpassword' => base64_encode($request->get('new_password')), |
689 | ]); | 689 | ]); |
690 | return redirect() | 690 | return redirect() |
691 | ->route('employer.password_reset') | 691 | ->route('employer.password_reset') |
692 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 692 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
693 | } | 693 | } |
694 | 694 | ||
695 | return redirect() | 695 | return redirect() |
696 | ->route('employer.password_reset') | 696 | ->route('employer.password_reset') |
697 | ->withError('Данная учетная запись не было верифицированна!'); | 697 | ->withError('Данная учетная запись не было верифицированна!'); |
698 | } | 698 | } |
699 | } | 699 | } |
700 | 700 | ||
701 | return redirect() | 701 | return redirect() |
702 | ->route('employer.password_reset') | 702 | ->route('employer.password_reset') |
703 | ->withErrors('Не совпадение данных, обновите пароли!'); | 703 | ->withErrors('Не совпадение данных, обновите пароли!'); |
704 | } | 704 | } |
705 | 705 | ||
706 | 706 | ||
707 | 707 | ||
708 | // Форма Удаление пипла | 708 | // Форма Удаление пипла |
709 | public function delete_people() { | 709 | public function delete_people() { |
710 | $login = Auth()->user()->email; | 710 | $login = Auth()->user()->email; |
711 | return view('employers.delete_people', compact('login')); | 711 | return view('employers.delete_people', compact('login')); |
712 | } | 712 | } |
713 | 713 | ||
714 | // Удаление аккаунта | 714 | // Удаление аккаунта |
715 | public function action_delete_user(Request $request) { | 715 | public function action_delete_user(Request $request) { |
716 | $Answer = $request->all(); | 716 | $Answer = $request->all(); |
717 | $user_id = Auth()->user()->id; | 717 | $user_id = Auth()->user()->id; |
718 | $request->validate([ | 718 | $request->validate([ |
719 | 'password' => 'required|string', | 719 | 'password' => 'required|string', |
720 | ]); | 720 | ]); |
721 | 721 | ||
722 | $credentials = $request->only('email', 'password'); | 722 | $credentials = $request->only('email', 'password'); |
723 | if (Auth::attempt($credentials)) { | 723 | if (Auth::attempt($credentials)) { |
724 | Auth::logout(); | 724 | Auth::logout(); |
725 | $it = User_Model::find($user_id); | 725 | $it = User_Model::find($user_id); |
726 | $it->delete(); | 726 | $it->delete(); |
727 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 727 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
728 | } else { | 728 | } else { |
729 | return redirect()->route('employer.delete_people') | 729 | return redirect()->route('employer.delete_people') |
730 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 730 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
731 | } | 731 | } |
732 | } | 732 | } |
733 | 733 | ||
734 | public function ajax_delete_user(Request $request) { | 734 | public function ajax_delete_user(Request $request) { |
735 | $Answer = $request->all(); | 735 | $Answer = $request->all(); |
736 | $user_id = Auth()->user()->id; | 736 | $user_id = Auth()->user()->id; |
737 | $request->validate([ | 737 | $request->validate([ |
738 | 'password' => 'required|string', | 738 | 'password' => 'required|string', |
739 | ]); | 739 | ]); |
740 | $credentials = $request->only('email', 'password'); | 740 | $credentials = $request->only('email', 'password'); |
741 | if (Auth::attempt($credentials)) { | 741 | if (Auth::attempt($credentials)) { |
742 | 742 | ||
743 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', | 743 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', |
744 | 'email' => $request->get('email'), | 744 | 'email' => $request->get('email'), |
745 | 'password' => $request->get('password'))); | 745 | 'password' => $request->get('password'))); |
746 | } else { | 746 | } else { |
747 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); | 747 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); |
748 | } | 748 | } |
749 | } | 749 | } |
750 | 750 | ||
751 | // FAQ - Вопросы/ответы для работодателей и соискателей | 751 | // FAQ - Вопросы/ответы для работодателей и соискателей |
752 | public function faq() { | 752 | public function faq() { |
753 | return view('employers.faq'); | 753 | return view('employers.faq'); |
754 | } | 754 | } |
755 | 755 | ||
756 | // Рассылка сообщений | 756 | // Рассылка сообщений |
757 | public function send_all_messages() { | 757 | public function send_all_messages() { |
758 | $id = Auth()->user()->id; | 758 | $id = Auth()->user()->id; |
759 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); | 759 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); |
760 | if ($sending->sending_is) | 760 | if ($sending->sending_is) |
761 | return view('employers.send_all'); | 761 | return view('employers.send_all'); |
762 | else | 762 | else |
763 | return view('employers.send_all_danger'); | 763 | return view('employers.send_all_danger'); |
764 | } | 764 | } |
765 | 765 | ||
766 | // Отправка сообщений для информации | 766 | // Отправка сообщений для информации |
767 | public function send_all_post(Request $request) { | 767 | public function send_all_post(Request $request) { |
768 | $data = $request->all(); | 768 | $data = $request->all(); |
769 | 769 | ||
770 | $emails = User_Model::query()->where('is_worker', '1')->get(); | 770 | $emails = User_Model::query()->where('is_worker', '1')->get(); |
771 | 771 | ||
772 | foreach ($emails as $e) { | 772 | foreach ($emails as $e) { |
773 | Mail::to($e->email)->send(new SendAllMessages($data)); | 773 | Mail::to($e->email)->send(new SendAllMessages($data)); |
774 | } | 774 | } |
775 | 775 | ||
776 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); | 776 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); |
777 | } | 777 | } |
778 | 778 | ||
779 | // База резюме | 779 | // База резюме |
780 | public function bd_tupe(Request $request) { | 780 | public function bd_tupe(Request $request) { |
781 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); | 781 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); |
782 | 782 | ||
783 | return view('employers.bd_tupe', compact('Resume')); | 783 | return view('employers.bd_tupe', compact('Resume')); |
784 | } | 784 | } |
785 | 785 | ||
786 | ////////////////////////////////////////////////////////////////// | 786 | ////////////////////////////////////////////////////////////////// |
787 | // Отправил сообщение | 787 | // Отправил сообщение |
788 | ////////////////////////////////////////////////////////////////// | 788 | ////////////////////////////////////////////////////////////////// |
789 | public function new_message(Request $request) { | 789 | public function new_message(Request $request) { |
790 | $params = $request->all(); | 790 | $params = $request->all(); |
791 | $id = $params['_user_id']; | 791 | $id = $params['_user_id']; |
792 | $message = new Message(); | 792 | $message = new Message(); |
793 | $message->user_id = $params['_user_id']; | 793 | $message->user_id = $params['_user_id']; |
794 | $message->to_user_id = $params['_to_user_id']; | 794 | $message->to_user_id = $params['_to_user_id']; |
795 | $message->title = $params['title']; | 795 | $message->title = $params['title']; |
796 | $message->text = $params['text']; | 796 | $message->text = $params['text']; |
797 | if ($request->has('_file')) { | 797 | if ($request->has('_file')) { |
798 | $message->file = $request->file('_file')->store("worker/$id", 'public'); | 798 | $message->file = $request->file('_file')->store("worker/$id", 'public'); |
799 | } | 799 | } |
800 | $message->ad_employer_id = $params['_vacancy']; | 800 | $message->ad_employer_id = $params['_vacancy']; |
801 | $message->flag_new = 1; | 801 | $message->flag_new = 1; |
802 | $id_message = $message->save(); | 802 | $id_message = $message->save(); |
803 | 803 | ||
804 | //$data['message_id'] = $id_message; | 804 | //$data['message_id'] = $id_message; |
805 | //$data['ad_employer_id'] = $params['_vacancy']; | 805 | //$data['ad_employer_id'] = $params['_vacancy']; |
806 | //$data['job_title_id'] = 0; | 806 | //$data['job_title_id'] = 0; |
807 | 807 | ||
808 | $data['flag'] = 1; | 808 | $data['flag'] = 1; |
809 | //$ad_responce = ad_response::create($data); | 809 | //$ad_responce = ad_response::create($data); |
810 | return redirect()->route('employer.messages', ['type_message' => 'output']); | 810 | return redirect()->route('employer.messages', ['type_message' => 'output']); |
811 | } | 811 | } |
812 | 812 | ||
813 | // Восстановление пароля | 813 | // Восстановление пароля |
814 | public function repair_password(Request $request) { | 814 | public function repair_password(Request $request) { |
815 | $params = $request->get('email'); | 815 | $params = $request->get('email'); |
816 | } | 816 | } |
817 | 817 | ||
818 | // Избранные люди на корабль | 818 | // Избранные люди на корабль |
819 | public function selected_people(Request $request) { | 819 | public function selected_people(Request $request) { |
820 | $id = $request->get('id'); | 820 | $id = $request->get('id'); |
821 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 821 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
822 | where('is_remove', '=', '0')-> | 822 | where('is_remove', '=', '0')-> |
823 | where('is_bd', '=', '0')-> | 823 | where('is_bd', '=', '0')-> |
824 | where('position_id', $id)-> | 824 | where('position_id', $id)-> |
825 | get(); | 825 | get(); |
826 | return view('favorite_people', compact('favorite_people')); | 826 | return view('favorite_people', compact('favorite_people')); |
827 | } | 827 | } |
828 | } | 828 | } |
829 | 829 |
app/Http/Requests/PagesRequest.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Requests; | 3 | namespace App\Http\Requests; |
4 | 4 | ||
5 | use Illuminate\Foundation\Http\FormRequest; | 5 | use Illuminate\Foundation\Http\FormRequest; |
6 | 6 | ||
7 | class PagesRequest extends FormRequest | 7 | class PagesRequest extends FormRequest |
8 | { | 8 | { |
9 | /** | 9 | /** |
10 | * Determine if the user is authorized to make this request. | 10 | * Determine if the user is authorized to make this request. |
11 | * | 11 | * |
12 | * @return bool | 12 | * @return bool |
13 | */ | 13 | */ |
14 | public function authorize() | 14 | public function authorize() |
15 | { | 15 | { |
16 | return true; | 16 | return true; |
17 | } | 17 | } |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Get the validation rules that apply to the request. | 20 | * Get the validation rules that apply to the request. |
21 | * | 21 | * |
22 | * @return array<string, mixed> | 22 | * @return array<string, mixed> |
23 | */ | 23 | */ |
24 | public function rules() | 24 | public function rules() |
25 | { | 25 | { |
26 | $unique = 'unique:pages,slug'; | 26 | $unique = 'unique:pages,slug'; |
27 | if (in_array($this->route()->getName(), ['admin.update-page'])) { | 27 | if (in_array($this->route()->getName(), ['admin.update-page'])) { |
28 | // получаем модель Pages через маршрут admin/editor-pages/edit/{page} | 28 | // получаем модель Pages через маршрут admin/editor-pages/edit/{page} |
29 | $model = $this->route('page'); | 29 | $model = $this->route('page'); |
30 | /* | 30 | /* |
31 | * Проверка на уникальность slug, исключая этот пост по идентификатору: | 31 | * Проверка на уникальность slug, исключая этот пост по идентификатору: |
32 | * 1. posts - таблица базы данных, где проверяется уникальность | 32 | * 1. posts - таблица базы данных, где проверяется уникальность |
33 | * 2. slug - имя колонки, уникальность значения которой проверяется | 33 | * 2. slug - имя колонки, уникальность значения которой проверяется |
34 | * 3. значение по которому из проверки исключается запись таблицы БД | 34 | * 3. значение по которому из проверки исключается запись таблицы БД |
35 | * 4. поле, по которому из проверки исключается запись таблицы БД | 35 | * 4. поле, по которому из проверки исключается запись таблицы БД |
36 | * Для проверки будет использован такой SQL-запрос к базе данных: | 36 | * Для проверки будет использован такой SQL-запрос к базе данных: |
37 | * SELECT COUNT(*) FROM `pages` WHERE `slug` = '...' AND `id` <> 17 | 37 | * SELECT COUNT(*) FROM `pages` WHERE `slug` = '...' AND `id` <> 17 |
38 | */ | 38 | */ |
39 | $unique = 'unique:pages,slug,'.$model->id.',id'; | 39 | $unique = 'unique:pages,slug,'.$model->id.',id'; |
40 | } | 40 | } |
41 | 41 | ||
42 | return [ | 42 | return [ |
43 | 'name' => [ | 43 | 'name' => [ |
44 | 'required', | 44 | 'required', |
45 | 'string', | 45 | 'string', |
46 | 'min:3', | 46 | 'min:3', |
47 | 'max:255', | 47 | 'max:255', |
48 | ], | 48 | ], |
49 | 'slug' => [ | 49 | 'slug' => [ |
50 | 'required', | 50 | 'required', |
51 | 'max:255', | 51 | 'max:255', |
52 | $unique, | 52 | $unique, |
53 | 'regex:~^[-_a-z0-9]+$~i', | 53 | 'regex:~^[-_a-z0-9]+$~i', |
54 | ], | 54 | ], |
55 | 'anons' => [ | 55 | 'anons' => [ |
56 | 'required', | 56 | 'required', |
57 | 'min:50', | ||
58 | ], | 57 | ], |
59 | 'text' => [ | 58 | 'text2' => [ |
60 | 'required', | 59 | 'required', |
61 | 'min:255', | ||
62 | ], | 60 | ], |
63 | 'image' => [ | 61 | 'image' => [ |
64 | 'mimes:jpeg,jpg,png', | 62 | 'mimes:jpeg,jpg,png', |
65 | 'max:15000' | 63 | 'max:15000' |
66 | ], | 64 | ], |
67 | ]; | 65 | ]; |
68 | } | 66 | } |
69 | 67 | ||
70 | public function messages() { | 68 | public function messages() { |
71 | return [ | 69 | return [ |
72 | 'required' => 'Поле :attribute обязательно для ввода', | 70 | 'required' => 'Поле :attribute обязательно для ввода', |
73 | 'unique' => 'Поле :attribute должно быть уникальным', | 71 | 'unique' => 'Поле :attribute должно быть уникальным', |
74 | 'mimes' => 'Допускаются файлы только с расширением jpeg,jpg,png', | 72 | 'mimes' => 'Допускаются файлы только с расширением jpeg,jpg,png', |
75 | 'min' => [ | 73 | 'min' => [ |
76 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 74 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
77 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 75 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
78 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 76 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
79 | ], | 77 | ], |
80 | 78 | ||
81 | 'max' => [ | 79 | 'max' => [ |
82 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 80 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
83 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 81 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
84 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 82 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
85 | ], | 83 | ], |
86 | 84 | ||
87 | ]; | 85 | ]; |
88 | } | 86 | } |
89 | } | 87 | } |
90 | 88 |
app/Models/pages.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 pages extends Model | 8 | class pages extends Model |
9 | { | 9 | { |
10 | use HasFactory; | 10 | use HasFactory; |
11 | 11 | ||
12 | protected $fillable = [ | 12 | protected $fillable = [ |
13 | 'name', | 13 | 'name', |
14 | 'slug', | 14 | 'slug', |
15 | 'text', | 15 | 'text', |
16 | 'anons', | 16 | 'anons', |
17 | 'author', | 17 | 'author', |
18 | 'image', | 18 | 'image', |
19 | 'text2' | ||
19 | ]; | 20 | ]; |
20 | } | 21 | } |
21 | 22 |
database/migrations/2024_06_06_092618_alter_table_pages.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('pages', function (Blueprint $table) { | ||
17 | $table->longText('text2')->nullable(true); | ||
18 | }); | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * Reverse the migrations. | ||
23 | * | ||
24 | * @return void | ||
25 | */ | ||
26 | public function down() | ||
27 | { | ||
28 | Schema::table('pages', function (Blueprint $table) { | ||
29 | $table->dropColumn('text2'); | ||
30 | }); | ||
31 | } | ||
32 | }; | ||
33 |
resources/views/admin/pages/form.blade.php
1 | @csrf | 1 | @csrf |
2 | 2 | ||
3 | @isset($page) | 3 | @isset($page) |
4 | @method('PUT') | 4 | @method('PUT') |
5 | @endisset | 5 | @endisset |
6 | 6 | ||
7 | <script> | 7 | <script> |
8 | function translit(word){ | 8 | function translit(word){ |
9 | var answer = ''; | 9 | var answer = ''; |
10 | var converter = { | 10 | var converter = { |
11 | 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', | 11 | 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', |
12 | 'е': 'e', 'ё': 'e', 'ж': 'zh', 'з': 'z', 'и': 'i', | 12 | 'е': 'e', 'ё': 'e', 'ж': 'zh', 'з': 'z', 'и': 'i', |
13 | 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', | 13 | 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', |
14 | 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't', | 14 | 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't', |
15 | 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch', | 15 | 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch', |
16 | 'ш': 'sh', 'щ': 'sch', 'ь': '', 'ы': 'y', 'ъ': '', | 16 | 'ш': 'sh', 'щ': 'sch', 'ь': '', 'ы': 'y', 'ъ': '', |
17 | 'э': 'e', 'ю': 'yu', 'я': 'ya', | 17 | 'э': 'e', 'ю': 'yu', 'я': 'ya', |
18 | 18 | ||
19 | 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', | 19 | 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', |
20 | 'Е': 'E', 'Ё': 'E', 'Ж': 'Zh', 'З': 'Z', 'И': 'I', | 20 | 'Е': 'E', 'Ё': 'E', 'Ж': 'Zh', 'З': 'Z', 'И': 'I', |
21 | 'Й': 'Y', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N', | 21 | 'Й': 'Y', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N', |
22 | 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', | 22 | 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', |
23 | 'У': 'U', 'Ф': 'F', 'Х': 'H', 'Ц': 'C', 'Ч': 'Ch', | 23 | 'У': 'U', 'Ф': 'F', 'Х': 'H', 'Ц': 'C', 'Ч': 'Ch', |
24 | 'Ш': 'Sh', 'Щ': 'Sch', 'Ь': '', 'Ы': 'Y', 'Ъ': '', | 24 | 'Ш': 'Sh', 'Щ': 'Sch', 'Ь': '', 'Ы': 'Y', 'Ъ': '', |
25 | 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya', ' ': '-' | 25 | 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya', ' ': '-' |
26 | }; | 26 | }; |
27 | 27 | ||
28 | for (var i = 0; i < word.length; ++i ) { | 28 | for (var i = 0; i < word.length; ++i ) { |
29 | if (converter[word[i]] == undefined){ | 29 | if (converter[word[i]] == undefined){ |
30 | answer += word[i]; | 30 | answer += word[i]; |
31 | } else { | 31 | } else { |
32 | answer += converter[word[i]]; | 32 | answer += converter[word[i]]; |
33 | } | 33 | } |
34 | } | 34 | } |
35 | 35 | ||
36 | return answer; | 36 | return answer; |
37 | } | 37 | } |
38 | 38 | ||
39 | window.addEventListener("DOMContentLoaded", (event) => { | 39 | window.addEventListener("DOMContentLoaded", (event) => { |
40 | let title = document.querySelector('#name'); | 40 | let title = document.querySelector('#name'); |
41 | let text = document.querySelector('#slug'); | 41 | let text = document.querySelector('#slug'); |
42 | 42 | ||
43 | title.addEventListener('input', function() { | 43 | title.addEventListener('input', function() { |
44 | text.value = translit(this.value); | 44 | text.value = translit(this.value); |
45 | }); | 45 | }); |
46 | }); | 46 | }); |
47 | 47 | ||
48 | </script> | 48 | </script> |
49 | <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> | 49 | <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> |
50 | <label class="block text-sm"> | 50 | <label class="block text-sm"> |
51 | <span class="text-gray-700 dark:text-gray-400">Название страницы</span> | 51 | <span class="text-gray-700 dark:text-gray-400">Название страницы</span> |
52 | <input name="name" id="name" | 52 | <input name="name" id="name" |
53 | class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" | 53 | class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" |
54 | placeholder="Имя категории" value="{{ old('name') ?? $page->name ?? '' }}" | 54 | placeholder="Имя категории" value="{{ old('name') ?? $page->name ?? '' }}" |
55 | /> | 55 | /> |
56 | @error('name') | 56 | @error('name') |
57 | <span class="text-xs text-red-600 dark:text-red-400"> | 57 | <span class="text-xs text-red-600 dark:text-red-400"> |
58 | {{ $message }} | 58 | {{ $message }} |
59 | </span> | 59 | </span> |
60 | @enderror | 60 | @enderror |
61 | </label><br> | 61 | </label><br> |
62 | 62 | ||
63 | <label class="block text-sm"> | 63 | <label class="block text-sm"> |
64 | <span class="text-gray-700 dark:text-gray-400">Английский псевдоним страницы</span> | 64 | <span class="text-gray-700 dark:text-gray-400">Английский псевдоним страницы</span> |
65 | <input name="slug" id="slug" | 65 | <input name="slug" id="slug" |
66 | class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" | 66 | class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" |
67 | placeholder="Имя категории" value="{{ old('slug') ?? $page->slug ?? '' }}" | 67 | placeholder="Имя категории" value="{{ old('slug') ?? $page->slug ?? '' }}" |
68 | /> | 68 | /> |
69 | @error('slug') | 69 | @error('slug') |
70 | <span class="text-xs text-red-600 dark:text-red-400"> | 70 | <span class="text-xs text-red-600 dark:text-red-400"> |
71 | {{ $message }} | 71 | {{ $message }} |
72 | </span> | 72 | </span> |
73 | @enderror | 73 | @enderror |
74 | </label><br> | 74 | </label><br> |
75 | 75 | ||
76 | <label class="block text-sm"> | 76 | <label class="block text-sm"> |
77 | <span class="text-gray-700 dark:text-gray-400">Анонс</span> | 77 | <span class="text-gray-700 dark:text-gray-400">Анонс</span> |
78 | <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="anons" placeholder="Анонс (html)" required | 78 | <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="anons" placeholder="Анонс (html)" required |
79 | rows="10">{{ old('anons') ?? $page->anons ?? '' }}</textarea> | 79 | rows="10">{{ old('anons') ?? $page->anons ?? '' }}</textarea> |
80 | @error('anons') | 80 | @error('anons') |
81 | <span class="text-xs text-red-600 dark:text-red-400"> | 81 | <span class="text-xs text-red-600 dark:text-red-400"> |
82 | {{ $message }} | 82 | {{ $message }} |
83 | </span> | 83 | </span> |
84 | @enderror | 84 | @enderror |
85 | </label><br> | 85 | </label><br> |
86 | 86 | ||
87 | <label class="block text-sm"> | 87 | <label class="block text-sm"> |
88 | <span class="text-gray-700 dark:text-gray-400">Текст</span> | 88 | <span class="text-gray-700 dark:text-gray-400">Текст</span> |
89 | <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" placeholder="Текст (html)" required | 89 | <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text2" placeholder="Текст (html)" required |
90 | rows="10">{{ old('text') ?? $page->text ?? '' }}</textarea> | 90 | rows="10">{{ old('text2') ?? $page->text2 ?? '' }}</textarea> |
91 | @error('text') | 91 | @error('text2') |
92 | <span class="text-xs text-red-600 dark:text-red-400"> | 92 | <span class="text-xs text-red-600 dark:text-red-400"> |
93 | {{ $message }} | 93 | {{ $message }} |
94 | </span> | 94 | </span> |
95 | @enderror | 95 | @enderror |
96 | </label><br> | 96 | </label><br> |
97 | 97 | ||
98 | <label class="block text-sm"> | 98 | <label class="block text-sm"> |
99 | <span class="text-gray-700 dark:text-gray-400">Автор</span> | 99 | <span class="text-gray-700 dark:text-gray-400">Автор</span> |
100 | <input name="author" id="author" | 100 | <input name="author" id="author" |
101 | class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" | 101 | class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" |
102 | placeholder="Имя категории" value="{{ old('author') ?? $page->author ?? '' }}" | 102 | placeholder="Имя категории" value="{{ old('author') ?? $page->author ?? '' }}" |
103 | /> | 103 | /> |
104 | @error('author') | 104 | @error('author') |
105 | <span class="text-xs text-red-600 dark:text-red-400"> | 105 | <span class="text-xs text-red-600 dark:text-red-400"> |
106 | {{ $message }} | 106 | {{ $message }} |
107 | </span> | 107 | </span> |
108 | @enderror | 108 | @enderror |
109 | </label><br> | 109 | </label><br> |
110 | 110 | ||
111 | <label class="block text-sm"> | 111 | <label class="block text-sm"> |
112 | <span class="text-gray-700 dark:text-gray-400">Картинка</span> | 112 | <span class="text-gray-700 dark:text-gray-400">Картинка</span> |
113 | <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 | 113 | <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 |
114 | focus:border-purple-400 focus:outline-none focus:shadow-outline-purple | 114 | focus:border-purple-400 focus:outline-none focus:shadow-outline-purple |
115 | dark:text-gray-300 dark:focus:shadow-outline-gray form-input" | 115 | dark:text-gray-300 dark:focus:shadow-outline-gray form-input" |
116 | id="image" name="image" accept="image/png, image/jpeg"> | 116 | id="image" name="image" accept="image/png, image/jpeg"> |
117 | @error('image') | 117 | @error('image') |
118 | <span class="text-xs text-red-600 dark:text-red-400"> | 118 | <span class="text-xs text-red-600 dark:text-red-400"> |
119 | {{ $message }} | 119 | {{ $message }} |
120 | </span> | 120 | </span> |
121 | @enderror | 121 | @enderror |
122 | @isset($page->image) | 122 | @isset($page->image) |
123 | <img src="{{asset(Storage::url($page->image))}}" width="100px"/> | 123 | <img src="{{asset(Storage::url($page->image))}}" width="100px"/> |
124 | @endisset | 124 | @endisset |
125 | </label><br> | 125 | </label><br> |
126 | 126 | ||
127 | <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> | 127 | <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> |
128 | <div> | 128 | <div> |
129 | <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> | 129 | <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> |
130 | Сохранить | 130 | Сохранить |
131 | </button> | 131 | </button> |
132 | <a href="{{ route('admin.editor-pages') }}" | 132 | <a href="{{ route('admin.editor-pages') }}" |
133 | class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" | 133 | class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" |
134 | style="display: -webkit-inline-box; height: 30px!important;" | 134 | style="display: -webkit-inline-box; height: 30px!important;" |
135 | >Назад</a> | 135 | >Назад</a> |
136 | </div> | 136 | </div> |
137 | </div> | 137 | </div> |
138 | </div> | 138 | </div> |
139 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> | 139 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> |
140 | <script> | 140 | <script> |
141 | CKEDITOR.replace( 'anons'); | 141 | CKEDITOR.replace( 'anons'); |
142 | CKEDITOR.replace( 'text', { | 142 | CKEDITOR.replace( 'text2', { |
143 | filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | 143 | filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", |
144 | filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | 144 | filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", |
145 | filebrowserUploadMethod: 'form' | 145 | filebrowserUploadMethod: 'form' |
146 | }); | 146 | }); |
147 | </script> | 147 | </script> |
148 | 148 |
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"> | 20 | <a href="{{ route('employer.employer_info') }}" class="cabinet__menu-item @if ($item==0) active @endif"> |
21 | <i> | 21 | <i> |
22 | <svg> | 22 | <svg> |
23 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> | 23 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> |
24 | </svg> | 24 | </svg> |
25 | </i> | 25 | </i> |
26 | <span>Личные данные</span> | 26 | <span>Личные данные</span> |
27 | </a> | 27 | </a> |
28 | <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"> |
29 | <i> | 29 | <i> |
30 | <svg> | 30 | <svg> |
31 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> | 31 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> |
32 | </svg> | 32 | </svg> |
33 | </i> | 33 | </i> |
34 | <span>Профиль</span> | 34 | <span>Профиль</span> |
35 | </a> | 35 | </a> |
36 | @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_public)) | 36 | @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_public)) |
37 | <a href="{{ route('employer.cabinet_vacancie') }}" class="cabinet__menu-item @if ($item==2) active @endif"> | 37 | <a href="{{ route('employer.cabinet_vacancie') }}" class="cabinet__menu-item @if ($item==2) active @endif"> |
38 | <i> | 38 | <i> |
39 | <svg> | 39 | <svg> |
40 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use> | 40 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use> |
41 | </svg> | 41 | </svg> |
42 | </i> | 42 | </i> |
43 | <span>Разместить вакансию</span> | 43 | <span>Разместить вакансию</span> |
44 | </a> | 44 | </a> |
45 | @else | 45 | @else |
46 | <a href="{{ route('employer.cabinet_vacancie_danger') }}" class="cabinet__menu-item @if ($item==2) active @endif"> | 46 | <a href="{{ route('employer.cabinet_vacancie_danger') }}" class="cabinet__menu-item @if ($item==2) active @endif"> |
47 | <i> | 47 | <i> |
48 | <svg> | 48 | <svg> |
49 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use> | 49 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use> |
50 | </svg> | 50 | </svg> |
51 | </i> | 51 | </i> |
52 | <span>Разместить вакансию</span> | 52 | <span>Разместить вакансию</span> |
53 | </a> | 53 | </a> |
54 | @endif | 54 | @endif |
55 | <a href="{{ route('employer.vacancy_list') }}" class="cabinet__menu-item @if ($item==3) active @endif"> | 55 | <a href="{{ route('employer.vacancy_list') }}" class="cabinet__menu-item @if ($item==3) active @endif"> |
56 | <i> | 56 | <i> |
57 | <svg> | 57 | <svg> |
58 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-3') }}"></use> | 58 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-3') }}"></use> |
59 | </svg> | 59 | </svg> |
60 | </i> | 60 | </i> |
61 | <span>Мои вакансии</span> | 61 | <span>Мои вакансии</span> |
62 | </a> | 62 | </a> |
63 | <a href="{{ route('employer.answers', ['employer' => $id_employer]) }}" class="cabinet__menu-item @if ($item==4) active @endif"> | 63 | <!-- <a href="{ route('employer.answers', ['employer' => $id_employer]) }}" class="cabinet__menu-item if ($item==4) active endif"> |
64 | <i> | 64 | <i> |
65 | <svg> | 65 | <svg> |
66 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-4') }}"></use> | 66 | <use xlink:href="{ asset('images/sprite.svg#cabinet-4') }}"></use> |
67 | </svg> | 67 | </svg> |
68 | </i> | 68 | </i> |
69 | <span>Отклики на вакансию</span> | 69 | <span>Отклики на вакансию</span> |
70 | </a> | 70 | </a>--> |
71 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==5) active @endif"> | 71 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==5) active @endif"> |
72 | <i> | 72 | <i> |
73 | <svg> | 73 | <svg> |
74 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use> | 74 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use> |
75 | </svg> | 75 | </svg> |
76 | </i> | 76 | </i> |
77 | <span>Сообщения</span> | 77 | <span>Сообщения</span> |
78 | </a> | 78 | </a> |
79 | <a href="{{ route('employer.favorites') }}" class="cabinet__menu-item @if ($item==6) active @endif"> | 79 | <a href="{{ route('employer.favorites') }}" class="cabinet__menu-item @if ($item==6) active @endif"> |
80 | <i> | 80 | <i> |
81 | <svg> | 81 | <svg> |
82 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use> | 82 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use> |
83 | </svg> | 83 | </svg> |
84 | </i> | 84 | </i> |
85 | <span>Избранные кандидаты</span> | 85 | <span>Избранные кандидаты</span> |
86 | </a> | 86 | </a> |
87 | <a href="{{ route('employer.bd') }}" class="cabinet__menu-item @if ($item==7) active @endif"> | 87 | <a href="{{ route('employer.bd') }}" class="cabinet__menu-item @if ($item==7) active @endif"> |
88 | <i> | 88 | <i> |
89 | <svg> | 89 | <svg> |
90 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-7')}}"></use> | 90 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-7')}}"></use> |
91 | </svg> | 91 | </svg> |
92 | </i> | 92 | </i> |
93 | <span>База данных</span> | 93 | <span>База данных</span> |
94 | </a> | 94 | </a> |
95 | @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) | 95 | @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) |
96 | <a href="{{ route('bd_resume') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif"> | 96 | <a href="{{ route('bd_resume') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif"> |
97 | <i> | 97 | <i> |
98 | <svg> | 98 | <svg> |
99 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use> | 99 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use> |
100 | </svg> | 100 | </svg> |
101 | </i> | 101 | </i> |
102 | <span>База резюме</span> | 102 | <span>База резюме</span> |
103 | </a> | 103 | </a> |
104 | @else | 104 | @else |
105 | <a href="{{ route('bd_resume_danger') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif"> | 105 | <a href="{{ route('bd_resume_danger') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif"> |
106 | <i> | 106 | <i> |
107 | <svg> | 107 | <svg> |
108 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use> | 108 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use> |
109 | </svg> | 109 | </svg> |
110 | </i> | 110 | </i> |
111 | <span>База резюме</span> | 111 | <span>База резюме</span> |
112 | </a> | 112 | </a> |
113 | @endif | 113 | @endif |
114 | <a href="{{ route('employer.send_all_messages') }}" class="cabinet__menu-item @if ($item==9) active @endif"> | 114 | <a href="{{ route('employer.send_all_messages') }}" class="cabinet__menu-item @if ($item==9) active @endif"> |
115 | <i> | 115 | <i> |
116 | <svg> | 116 | <svg> |
117 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-9') }}"></use> | 117 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-9') }}"></use> |
118 | </svg> | 118 | </svg> |
119 | </i> | 119 | </i> |
120 | <span>Рассылка сообщений</span> | 120 | <span>Рассылка сообщений</span> |
121 | </a> | 121 | </a> |
122 | <a href="{{ route('employer.faq') }}" class="cabinet__menu-item @if ($item==10) active @endif"> | 122 | <a href="{{ route('employer.faq') }}" class="cabinet__menu-item @if ($item==10) active @endif"> |
123 | <i> | 123 | <i> |
124 | <svg> | 124 | <svg> |
125 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-10') }}"></use> | 125 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-10') }}"></use> |
126 | </svg> | 126 | </svg> |
127 | </i> | 127 | </i> |
128 | <span>FAQ</span> | 128 | <span>FAQ</span> |
129 | </a> | 129 | </a> |
130 | <a href="{{ route('employer.subscribe') }}" class="cabinet__menu-item @if ($item==11) active @endif"> | 130 | <a href="{{ route('employer.subscribe') }}" class="cabinet__menu-item @if ($item==11) active @endif"> |
131 | <i> | 131 | <i> |
132 | <svg> | 132 | <svg> |
133 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> | 133 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> |
134 | </svg> | 134 | </svg> |
135 | </i> | 135 | </i> |
136 | <span>Настройки уведомлений</span> | 136 | <span>Настройки уведомлений</span> |
137 | </a> | 137 | </a> |
138 | <a href="{{ route('employer.slider_flot') }}" class="cabinet__menu-item @if ($item==12) active @endif"> | 138 | <a href="{{ route('employer.slider_flot') }}" class="cabinet__menu-item @if ($item==12) active @endif"> |
139 | <i> | 139 | <i> |
140 | <svg> | 140 | <svg> |
141 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> | 141 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> |
142 | </svg> | 142 | </svg> |
143 | </i> | 143 | </i> |
144 | <span>Мой флот</span> | 144 | <span>Мой флот</span> |
145 | </a> | 145 | </a> |
146 | <a href="{{ route('employer.password_reset') }}" class="cabinet__menu-item green @if ($item==13) active @endif"> | 146 | <a href="{{ route('employer.password_reset') }}" class="cabinet__menu-item green @if ($item==13) active @endif"> |
147 | <i></i> | 147 | <i></i> |
148 | <span>Сменить пароль</span> | 148 | <span>Сменить пароль</span> |
149 | </a> | 149 | </a> |
150 | <a href="{{ route('employer.delete_people') }}" class="cabinet__menu-item red @if ($item==14) active @endif"> | 150 | <a href="{{ route('employer.delete_people') }}" class="cabinet__menu-item red @if ($item==14) active @endif"> |
151 | <i></i> | 151 | <i></i> |
152 | <span>Удалить профиль</span> | 152 | <span>Удалить профиль</span> |
153 | </a> | 153 | </a> |
154 | </div> | 154 | </div> |
155 | <div class="cabinet__menu-bottom"> | 155 | <div class="cabinet__menu-bottom"> |
156 | <a href="{{ route('logout') }}" class="button cabinet__menu-leave"> | 156 | <a href="{{ route('logout') }}" class="button cabinet__menu-leave"> |
157 | <svg> | 157 | <svg> |
158 | <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use> | 158 | <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use> |
159 | </svg> | 159 | </svg> |
160 | Выход | 160 | Выход |
161 | </a> | 161 | </a> |
162 | <span class="cabinet__menu-copy"> | 162 | <span class="cabinet__menu-copy"> |
163 | © 2020 – Rekamore.su | 163 | © 2020 – Rekamore.su |
164 | </span> | 164 | </span> |
165 | </div> | 165 | </div> |
166 | </div> | 166 | </div> |
167 | </div> | 167 | </div> |
168 | </div> | 168 | </div> |
169 | 169 |
resources/views/pages.blade.php
1 | @extends('layout.frontend', ['title' => $page->name.'- РекаМоре']) | 1 | @extends('layout.frontend', ['title' => $page->name.'- РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | @endsection | 4 | @endsection |
5 | 5 | ||
6 | @section('content') | 6 | @section('content') |
7 | <section class="thing"> | 7 | <section class="thing"> |
8 | <div class="container"> | 8 | <div class="container"> |
9 | <div class="thing__body"> | 9 | <div class="thing__body"> |
10 | <ul class="breadcrumbs thing__breadcrumbs"> | 10 | <ul class="breadcrumbs thing__breadcrumbs"> |
11 | <li><a href="{{ route('index') }}">Главная</a></li> | 11 | <li><a href="{{ route('index') }}">Главная</a></li> |
12 | <li><b>{{ $page->name }}</b></li> | 12 | <li><b>{{ $page->name }}</b></li> |
13 | </ul> | 13 | </ul> |
14 | @isset($page->image) | 14 | @isset($page->image) |
15 | <img src=" {{ asset(Storage::url($page->image)) }}" alt="" class="thing__pic thing__pic_two"> | 15 | <img src=" {{ asset(Storage::url($page->image)) }}" alt="" class="thing__pic thing__pic_two"> |
16 | @endif | 16 | @endif |
17 | <h1 class="thing__title">{{ $page->name }}</h1> | 17 | <h1 class="thing__title">{{ $page->name }}</h1> |
18 | <p class="thing__text">{!! $page->anons !!}</p> | 18 | <p class="thing__text">{!! $page->anons !!}</p> |
19 | @if ($slug == 'Usloviya-razmescheniya') | 19 | @if ($slug == 'Usloviya-razmescheniya') |
20 | <div class="thing__buttons"> | 20 | <div class="thing__buttons"> |
21 | <a href="{{ route('shipping_companies') }}" class="button">Список компаний</a> | 21 | <a href="{{ route('shipping_companies') }}" class="button">Список компаний</a> |
22 | </div> | 22 | </div> |
23 | @endif | 23 | @endif |
24 | </div> | 24 | </div> |
25 | </div> | 25 | </div> |
26 | </section> | 26 | </section> |
27 | @if ($page->slug !== 'Usloviya-razmescheniya') | 27 | @if ($page->slug !== 'Usloviya-razmescheniya') |
28 | <main class="main"> | 28 | <main class="main"> |
29 | <div class="container"> | 29 | <div class="container"> |
30 | <div class="main__content"> | 30 | <div class="main__content"> |
31 | <div class="main__content-item"> | 31 | <div class="main__content-item"> |
32 | {!! $page->text !!} | 32 | {!! $page->text2 !!} |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | </div> | 35 | </div> |
36 | </main> | 36 | </main> |
37 | @else | 37 | @else |
38 | <main class="main"> | 38 | <main class="main"> |
39 | <div class="container"> | 39 | <div class="container"> |
40 | <div class="main__cond"> | 40 | <div class="main__cond"> |
41 | <div class="main__cond-label"> | 41 | <div class="main__cond-label"> |
42 | На рынке мы с 2020 года. | 42 | На рынке мы с 2020 года. |
43 | <br>Мы молодая компания, которой важно сделать хороший и востребованный продукт! | 43 | <br>Мы молодая компания, которой важно сделать хороший и востребованный продукт! |
44 | </div> | 44 | </div> |
45 | <div> | 45 | <div> |
46 | <h3>За это время нам удалось:</h3> | 46 | <h3>За это время нам удалось:</h3> |
47 | <ul class="main__cond-icons"> | 47 | <ul class="main__cond-icons"> |
48 | <li> | 48 | <li> |
49 | <span><img src="{{ asset('images/svg/1.svg') }}" alt=""></span> | 49 | <span><img src="{{ asset('images/svg/1.svg') }}" alt=""></span> |
50 | Создать самое крупное сообщество Вконтакте по поиску работы на речноми морском флоте | 50 | Создать самое крупное сообщество Вконтакте по поиску работы на речноми морском флоте |
51 | </li> | 51 | </li> |
52 | <li> | 52 | <li> |
53 | <span><img src="{{ asset('images/svg/2.svg') }}" alt=""></span> | 53 | <span><img src="{{ asset('images/svg/2.svg') }}" alt=""></span> |
54 | Создать самый крупный телеграм канал по поиску работы на речноми морском флоте | 54 | Создать самый крупный телеграм канал по поиску работы на речноми морском флоте |
55 | </li> | 55 | </li> |
56 | <li> | 56 | <li> |
57 | <span><img src="{{ asset('images/svg/3.svg') }}" alt=""></span> | 57 | <span><img src="{{ asset('images/svg/3.svg') }}" alt=""></span> |
58 | Создать действительно эффективную и удобную базу анкет | 58 | Создать действительно эффективную и удобную базу анкет |
59 | </li> | 59 | </li> |
60 | <li> | 60 | <li> |
61 | <span><img src="{{ asset('images/svg/4.svg') }}" alt=""></span> | 61 | <span><img src="{{ asset('images/svg/4.svg') }}" alt=""></span> |
62 | Разместить свою рекламу во многих учебных заведениях нашей страны. Колледжи,вузы, утц, медицинские центры охотно размещают нашу рекламу в своих заведениях | 62 | Разместить свою рекламу во многих учебных заведениях нашей страны. Колледжи,вузы, утц, медицинские центры охотно размещают нашу рекламу в своих заведениях |
63 | </li> | 63 | </li> |
64 | <li> | 64 | <li> |
65 | <span><img src="{{ asset('images/svg/5.svg') }}" alt=""></span> | 65 | <span><img src="{{ asset('images/svg/5.svg') }}" alt=""></span> |
66 | Подключить к нашему сервису более 120 судоходных компаний России | 66 | Подключить к нашему сервису более 120 судоходных компаний России |
67 | </li> | 67 | </li> |
68 | <li> | 68 | <li> |
69 | <span><img src="{{ asset('images/svg/6.svg') }}" alt=""></span> | 69 | <span><img src="{{ asset('images/svg/6.svg') }}" alt=""></span> |
70 | Оправдать доверие и ожидание, так как компании заключившие с нами договорв первый раз в 95% случаев остаются довольны сотрудничеством и продлевают договор | 70 | Оправдать доверие и ожидание, так как компании заключившие с нами договорв первый раз в 95% случаев остаются довольны сотрудничеством и продлевают договор |
71 | </li> | 71 | </li> |
72 | </ul> | 72 | </ul> |
73 | </div> | 73 | </div> |
74 | <div> | 74 | <div> |
75 | <h3>Форма обратной связи</h3> | 75 | <h3>Форма обратной связи</h3> |
76 | <p>Все поля обязательны для заполнения.</p> | 76 | <p>Все поля обязательны для заполнения.</p> |
77 | <form class="callback main__cond-callback" method="POST" action="{{ route('form_feedback') }}"> | 77 | <form class="callback main__cond-callback" method="POST" action="{{ route('form_feedback') }}"> |
78 | @csrf | 78 | @csrf |
79 | <div class="callback__body"> | 79 | <div class="callback__body"> |
80 | <input type="text" class="input" name="name" id="name" placeholder="Ваше имя" value="{{ old('name') ?? '' }}" required=""> | 80 | <input type="text" class="input" name="name" id="name" placeholder="Ваше имя" value="{{ old('name') ?? '' }}" required=""> |
81 | @error('name') | 81 | @error('name') |
82 | <span class="text-xs text-red-600"> | 82 | <span class="text-xs text-red-600"> |
83 | {{ $message }} | 83 | {{ $message }} |
84 | </span> | 84 | </span> |
85 | @enderror | 85 | @enderror |
86 | <input type="text" class="input" name="name_company" id="name_company" value="{{ old('name_company') ?? '' }}" placeholder="Название судоходной компании" required=""> | 86 | <input type="text" class="input" name="name_company" id="name_company" value="{{ old('name_company') ?? '' }}" placeholder="Название судоходной компании" required=""> |
87 | @error('name_company') | 87 | @error('name_company') |
88 | <span class="text-xs text-red-600"> | 88 | <span class="text-xs text-red-600"> |
89 | {{ $message }} | 89 | {{ $message }} |
90 | </span> | 90 | </span> |
91 | @enderror | 91 | @enderror |
92 | <input type="tel" class="input" name="telephone" id="telephone" value="{{ old('teelphone') ?? '' }}" placeholder="Телефон" required=""> | 92 | <input type="tel" class="input" name="telephone" id="telephone" value="{{ old('teelphone') ?? '' }}" placeholder="Телефон" required=""> |
93 | @error('telephone') | 93 | @error('telephone') |
94 | <span class="text-xs text-red-600"> | 94 | <span class="text-xs text-red-600"> |
95 | {{ $message }} | 95 | {{ $message }} |
96 | </span> | 96 | </span> |
97 | @enderror | 97 | @enderror |
98 | <input type="email" class="input" name="email" id="email" value="{{ old('email') ?? '' }}" placeholder="Электронная почта" required=""> | 98 | <input type="email" class="input" name="email" id="email" value="{{ old('email') ?? '' }}" placeholder="Электронная почта" required=""> |
99 | @error('email') | 99 | @error('email') |
100 | <span class="text-xs text-red-600"> | 100 | <span class="text-xs text-red-600"> |
101 | {{ $message }} | 101 | {{ $message }} |
102 | </span> | 102 | </span> |
103 | @enderror | 103 | @enderror |
104 | </div> | 104 | </div> |
105 | <textarea class="textarea callback__textarea" name="text" id="text" placeholder="Текст сообщения" required="">{{ old('text') ?? '' }}</textarea> | 105 | <textarea class="textarea callback__textarea" name="text" id="text" placeholder="Текст сообщения" required="">{{ old('text') ?? '' }}</textarea> |
106 | <div class="callback__bottom"> | 106 | <div class="callback__bottom"> |
107 | <label class="checkbox"> | 107 | <label class="checkbox"> |
108 | <input type="checkbox" name="politik" id="politik" class="checkbox__input" required=""> | 108 | <input type="checkbox" name="politik" id="politik" class="checkbox__input" required=""> |
109 | <span class="checkbox__icon"> | 109 | <span class="checkbox__icon"> |
110 | <svg> | 110 | <svg> |
111 | <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> | 111 | <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> |
112 | </svg> | 112 | </svg> |
113 | </span> | 113 | </span> |
114 | <span class="checkbox__text"> | 114 | <span class="checkbox__text"> |
115 | <span> | 115 | <span> |
116 | Я согласен(на) с | 116 | Я согласен(на) с |
117 | <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a> | 117 | <a href="{{ route('page', ['pages' => 'Politika-konfidencialnosti']) }}">Политикой конфиденциальности</a> |
118 | </span> | 118 | </span> |
119 | </span> | 119 | </span> |
120 | @error('politik') | 120 | @error('politik') |
121 | <span class="text-xs text-red-600"> | 121 | <span class="text-xs text-red-600"> |
122 | {{ $message }} | 122 | {{ $message }} |
123 | </span> | 123 | </span> |
124 | @enderror | 124 | @enderror |
125 | </label> | 125 | </label> |
126 | <button type="submit" class="button">Отправить</button> | 126 | <button type="submit" class="button">Отправить</button> |
127 | </div> | 127 | </div> |
128 | </form> | 128 | </form> |
129 | </div> | 129 | </div> |
130 | </div> | 130 | </div> |
131 | </div> | 131 | </div> |
132 | </main> | 132 | </main> |
133 | @endif | 133 | @endif |
134 | </div> | 134 | </div> |
135 | @endsection | 135 | @endsection |
136 | 136 |