Commit 31e0a8793ea2733bb379462f86b60c02d5fbcb10

Authored by Fedor
1 parent 8633df6d3f
Exists in master

task-132687 доделки без номеров

Showing 10 changed files with 83 additions and 33 deletions Inline Diff

app/Http/Controllers/Admin/EducationController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Http\Requests\EducationRequest; 6 use App\Http\Requests\EducationRequest;
7 use App\Http\Requests\ProgramEducationRequest; 7 use App\Http\Requests\ProgramEducationRequest;
8 use App\Models\Education; 8 use App\Models\Education;
9 use App\Models\ProgramEducation; 9 use App\Models\ProgramEducation;
10 use Illuminate\Http\Request; 10 use Illuminate\Http\Request;
11 use Illuminate\Support\Facades\DB; 11 use Illuminate\Support\Facades\DB;
12 use Illuminate\Support\Facades\Storage; 12 use Illuminate\Support\Facades\Storage;
13 13
14 class EducationController extends Controller 14 class EducationController extends Controller
15 { 15 {
16 /**
17 * Display a listing of the resource.
18 *
19 * @return \Illuminate\Http\Response
20 */
21 public function index() 16 public function index()
22 { 17 {
23 $education = Education::query()->active()->paginate(15); 18 $education = Education::query()
19 ->active()
20 ->paginate(15);
24 return view('admin.education.index', compact('education')); 21 return view('admin.education.index', compact('education'));
25 } 22 }
26 23
27 /**
28 * Show the form for creating a new resource.
29 *
30 * @return \Illuminate\Http\Response
31 */
32 public function create() 24 public function create()
33 { 25 {
34 return view('admin.education.add'); 26 return view('admin.education.add');
35 } 27 }
36 28
37 /** 29 /**
38 * Store a newly created resource in storage. 30 * Store a newly created resource in storage.
39 * 31 *
40 * @param \Illuminate\Http\Request $request 32 * @param \Illuminate\Http\Request $request
41 * @return \Illuminate\Http\Response 33 * @return \Illuminate\Http\Response
42 */ 34 */
43 public function store(EducationRequest $request) 35 public function store(EducationRequest $request)
44 { 36 {
45 $params = $request->all(); 37 $params = $request->all();
46 if ($request->has('image')) { 38 if ($request->has('image')) {
47 $params['image'] = $request->file('image')->store("education", 'public'); 39 $params['image'] = $request->file('image')->store("education", 'public');
48 } 40 }
49 Education::create($params); 41 Education::create($params);
50 42
51 43
52 return redirect()->route('admin.education.index'); 44 return redirect()->route('admin.education.index');
53 } 45 }
54 46
55 /** 47 /**
56 * Display the specified resource. 48 * Display the specified resource.
57 * 49 *
58 * @param \App\Models\Education $education 50 * @param \App\Models\Education $education
59 * @return \Illuminate\Http\Response 51 * @return \Illuminate\Http\Response
60 */ 52 */
61 public function show(Education $education) 53 public function show(Education $education)
62 { 54 {
63 // 55 //
64 } 56 }
65 57
66 /** 58 /**
67 * Show the form for editing the specified resource. 59 * Show the form for editing the specified resource.
68 * 60 *
69 * @param \App\Models\Education $education 61 * @param \App\Models\Education $education
70 * @return \Illuminate\Http\Response 62 * @return \Illuminate\Http\Response
71 */ 63 */
72 public function edit(Education $education) 64 public function edit(Education $education)
73 { 65 {
74 $program = ProgramEducation::query()->where('education_id', '=', $education->id) 66 $program = ProgramEducation::query()->where('education_id', '=', $education->id)
75 ->orderBy('level')->get(); 67 ->orderBy('level')->get();
76 return view('admin.education.edit', compact('education', 'program')); 68 return view('admin.education.edit', compact('education', 'program'));
77 } 69 }
78 70
79 /** 71 /**
80 * Update the specified resource in storage. 72 * Update the specified resource in storage.
81 * 73 *
82 * @param \Illuminate\Http\Request $request 74 * @param \Illuminate\Http\Request $request
83 * @param \App\Models\Education $education 75 * @param \App\Models\Education $education
84 * @return \Illuminate\Http\Response 76 * @return \Illuminate\Http\Response
85 */ 77 */
86 public function update(EducationRequest $request, Education $education) 78 public function update(EducationRequest $request, Education $education)
87 { 79 {
88 $params = $request->all(); 80 $params = $request->all();
89 if ($request->has('image')) { 81 if ($request->has('image')) {
90 if (!empty($education->image)) { 82 if (!empty($education->image)) {
91 Storage::delete($education->image); 83 Storage::delete($education->image);
92 } 84 }
93 $params['image'] = $request->file('image')->store("education", 'public'); 85 $params['image'] = $request->file('image')->store("education", 'public');
94 } 86 }
95 87
96 $education->update($params); 88 $education->update($params);
97 return redirect()->route('admin.education.index'); 89 return redirect()->route('admin.education.index');
98 } 90 }
99 91
100 /** 92 /**
101 * Remove the specified resource from storage. 93 * Remove the specified resource from storage.
102 * 94 *
103 * @param \App\Models\Education $education 95 * @param \App\Models\Education $education
104 * @return \Illuminate\Http\Response 96 * @return \Illuminate\Http\Response
105 */ 97 */
106 public function destroy(Education $education) 98 public function destroy(Education $education)
107 { 99 {
108 $education->update(['is_remove' => 1]); 100 $education->update(['is_remove' => 1]);
109 return redirect()->route('admin.education.index'); 101 return redirect()->route('admin.education.index');
110 } 102 }
111 103
112 public function rename_program(Request $request) { 104 public function rename_program(Request $request) {
113 if ($request->ajax()) { 105 if ($request->ajax()) {
114 $oldnamelevel = $request->oldname; 106 $oldnamelevel = $request->oldname;
115 $newnamelevel = $request->newname; 107 $newnamelevel = $request->newname;
116 $id_education = $request->id_education; 108 $id_education = $request->id_education;
117 109
118 $result = DB::table('program_education') 110 $result = DB::table('program_education')
119 ->where('education_id', '=', $id_education) 111 ->where('education_id', '=', $id_education)
120 ->where('level', '=', $oldnamelevel) 112 ->where('level', '=', $oldnamelevel)
121 ->update(['level' => $newnamelevel]); 113 ->update(['level' => $newnamelevel]);
122 114
123 return $result; 115 return $result;
124 } else return ""; 116 } else return "";
125 117
126 } 118 }
127 119
128 public function add_program(Request $request) { 120 public function add_program(Request $request) {
129 $id_education = $request->id; 121 $id_education = $request->id;
130 $level = $request->level; 122 $level = $request->level;
131 return view('admin.education.program', compact('id_education', 'level')); 123 return view('admin.education.program', compact('id_education', 'level'));
132 } 124 }
133 125
134 public function store_program(ProgramEducationRequest $request) { 126 public function store_program(ProgramEducationRequest $request) {
135 $education = $request->education_id; 127 $education = $request->education_id;
136 ProgramEducation::create($request->all()); 128 ProgramEducation::create($request->all());
137 129
138 return redirect()->route('admin.education.edit', ['education' => $education]); 130 return redirect()->route('admin.education.edit', ['education' => $education]);
139 } 131 }
140 132
141 public function edit_program(ProgramEducation $program, Education $education) { 133 public function edit_program(ProgramEducation $program, Education $education) {
142 $id_education = $education->id; 134 $id_education = $education->id;
143 return view('admin.education.program-edit', compact('id_education', 'education', 'program')); 135 return view('admin.education.program-edit', compact('id_education', 'education', 'program'));
144 } 136 }
145 137
146 public function update_program(ProgramEducationRequest $request, ProgramEducation $program, Education $education) { 138 public function update_program(ProgramEducationRequest $request, ProgramEducation $program, Education $education) {
147 $program->update($request->all()); 139 $program->update($request->all());
148 return redirect()->route('admin.education.edit', ['education' => $education]); 140 return redirect()->route('admin.education.edit', ['education' => $education]);
149 } 141 }
150 142
151 public function delete_program(ProgramEducation $program, Education $education) { 143 public function delete_program(ProgramEducation $program, Education $education) {
152 $education = $education->id; 144 $education = $education->id;
153 $program->delete(); 145 $program->delete();
154 146
155 return redirect()->route('admin.education.edit', ['education' => $education]); 147 return redirect()->route('admin.education.edit', ['education' => $education]);
156 } 148 }
app/Http/Controllers/EducationController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers; 3 namespace App\Http\Controllers;
4 4
5 use App\Models\Education; 5 use App\Models\Education;
6 use App\Models\ProgramEducation; 6 use App\Models\ProgramEducation;
7 use Illuminate\Http\Request; 7 use Illuminate\Http\Request;
8 8
9 class EducationController extends Controller 9 class EducationController extends Controller
10 { 10 {
11 // Образование 11 // Образование
12 public function index(Request $request) { 12 public function index(Request $request) {
13 $educations = Education::query(); 13 $educations = Education::query()->active();
14 if (($request->has('search')) && (!empty($request->get('search')))) { 14 if (($request->has('search')) && (!empty($request->get('search')))) {
15 $search = trim($request->get('search')); 15 $search = trim($request->get('search'));
16 $educations = $educations->where('name', 'LIKE', "%$search%"); 16 $educations = $educations->where('name', 'LIKE', "%$search%");
17 } 17 }
18 18
19 if ($request->get('sort')) { 19 if ($request->get('sort')) {
20 $sort = $request->get('sort'); 20 $sort = $request->get('sort');
21 switch ($sort) { 21 switch ($sort) {
22 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; 22 case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break;
23 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; 23 case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break;
24 case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; 24 case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break;
25 case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; 25 case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break;
26 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; 26 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break;
27 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; 27 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break;
28 } 28 }
29 } else { 29 } else {
30 $educations->orderBy('name'); 30 $educations->orderBy('name');
31 } 31 }
32 32
33 $count_edu = $educations->count(); 33 $count_edu = $educations->count();
34 $educations = $educations->paginate(6); 34 $educations = $educations->paginate(6);
35 if ($request->ajax()) { 35 if ($request->ajax()) {
36 return view('ajax.education', compact('educations')); 36 return view('ajax.education', compact('educations'));
37 } else { 37 } else {
38 return view('education.index', compact('educations', 'count_edu')); 38 return view('education.index', compact('educations', 'count_edu'));
39 } 39 }
40 } 40 }
41 41
42 public function show(Education $education){ 42 public function show(Education $education){
43 $education_programs = ProgramEducation::query() 43 $education_programs = ProgramEducation::query()
44 ->where('education_id', '=', $education->id) 44 ->where('education_id', '=', $education->id)
45 ->get() 45 ->get()
46 ; 46 ;
47 // Группировка коллекции по полю 'level' 47 // Группировка коллекции по полю 'level'
48 $levels_education_programs = $education_programs->groupBy('level')->map(function ($items, $key) { 48 $levels_education_programs = $education_programs->groupBy('level')->map(function ($items, $key) {
49 return $items->map(function ($item) { 49 return $items->map(function ($item) {
50 return $item->toArray(); 50 return $item->toArray();
51 })->toArray(); 51 })->toArray();
52 })->toArray(); 52 })->toArray();
53 //dd($levels_education_programs); 53 //dd($levels_education_programs);
54 return view('education.show', compact('education', 'levels_education_programs')); 54 return view('education.show', compact('education', 'levels_education_programs'));
55 } 55 }
56 } 56 }
57 57
app/Http/Controllers/EmployerController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers; 3 namespace App\Http\Controllers;
4 4
5 use App\Classes\RusDate; 5 use App\Classes\RusDate;
6 use App\Classes\Tools; 6 use App\Classes\Tools;
7 use App\Http\Requests\BaseUser_min_Request; 7 use App\Http\Requests\BaseUser_min_Request;
8 use App\Http\Requests\FlotRequest; 8 use App\Http\Requests\FlotRequest;
9 use App\Http\Requests\MessagesRequiest; 9 use App\Http\Requests\MessagesRequiest;
10 use App\Http\Requests\VacancyRequestEdit; 10 use App\Http\Requests\VacancyRequestEdit;
11 use App\Mail\MailCreateEmployer; 11 use App\Mail\MailCreateEmployer;
12 use App\Mail\MailSotrudnichestvo; 12 use App\Mail\MailSotrudnichestvo;
13 use App\Mail\MassSendingMessages; 13 use App\Mail\MassSendingMessages;
14 use App\Mail\SendAllMessages; 14 use App\Mail\SendAllMessages;
15 use App\Models\Ad_employer; 15 use App\Models\Ad_employer;
16 use App\Models\ad_response; 16 use App\Models\ad_response;
17 use App\Models\Category; 17 use App\Models\Category;
18 use App\Models\Chat; 18 use App\Models\Chat;
19 use App\Models\Employer; 19 use App\Models\Employer;
20 use App\Models\Flot; 20 use App\Models\Flot;
21 use App\Models\Job_title; 21 use App\Models\Job_title;
22 use App\Models\Like_worker; 22 use App\Models\Like_worker;
23 use App\Models\Message; 23 use App\Models\Message;
24 use App\Models\Worker; 24 use App\Models\Worker;
25 use App\Models\MessagesRequests; 25 use App\Models\MessagesRequests;
26 use Carbon\Carbon; 26 use Carbon\Carbon;
27 use Illuminate\Auth\Events\Registered; 27 use Illuminate\Auth\Events\Registered;
28 use Illuminate\Database\Eloquent\Builder; 28 use Illuminate\Database\Eloquent\Builder;
29 use Illuminate\Http\Request; 29 use Illuminate\Http\Request;
30 use Illuminate\Support\Facades\Auth; 30 use Illuminate\Support\Facades\Auth;
31 use Illuminate\Support\Facades\Hash; 31 use Illuminate\Support\Facades\Hash;
32 use Illuminate\Support\Facades\Log;
32 use Illuminate\Support\Facades\Mail; 33 use Illuminate\Support\Facades\Mail;
33 use Illuminate\Support\Facades\Storage; 34 use Illuminate\Support\Facades\Storage;
34 use App\Models\User as User_Model; 35 use App\Models\User as User_Model;
35 use Illuminate\Support\Facades\Validator; 36 use Illuminate\Support\Facades\Validator;
36 use App\Enums\DbExportColumns; 37 use App\Enums\DbExportColumns;
38 use Throwable;
37 39
38 class EmployerController extends Controller 40 class EmployerController extends Controller
39 { 41 {
40 public function vacancie($vacancy, Request $request) { 42 public function vacancie($vacancy, Request $request) {
41 $title = 'Заголовок вакансии'; 43 $title = 'Заголовок вакансии';
42 $Query = Ad_employer::with('jobs')-> 44 $Query = Ad_employer::with('jobs')->
43 with('cat')-> 45 with('cat')->
44 with('employer')-> 46 with('employer')->
45 with('jobs_code')-> 47 with('jobs_code')->
46 select('ad_employers.*')-> 48 select('ad_employers.*')->
47 where('id', '=', $vacancy)->get(); 49 where('id', '=', $vacancy)->get();
48 50
49 if (isset(Auth()->user()->id)) 51 if (isset(Auth()->user()->id))
50 $uid = Auth()->user()->id; 52 $uid = Auth()->user()->id;
51 else 53 else
52 $uid = 0; 54 $uid = 0;
53 $title = $Query[0]->name; 55 $title = $Query[0]->name;
54 if ($request->ajax()) { 56 if ($request->ajax()) {
55 return view('ajax.vacance-item', compact('Query','uid')); 57 return view('ajax.vacance-item', compact('Query','uid'));
56 } else { 58 } else {
57 return view('vacance-item', compact('title', 'Query', 'uid')); 59 return view('vacance-item', compact('title', 'Query', 'uid'));
58 } 60 }
59 } 61 }
60 62
61 public function logout() { 63 public function logout() {
62 Auth::logout(); 64 Auth::logout();
63 return redirect()->route('index') 65 return redirect()->route('index')
64 ->with('success', 'Вы вышли из личного кабинета'); 66 ->with('success', 'Вы вышли из личного кабинета');
65 } 67 }
66 68
67 public function employer_info() { 69 public function employer_info() {
68 // код юзера 70 // код юзера
69 $user_info = Auth()->user(); 71 $user_info = Auth()->user();
70 // вьюшка для вывода данных 72 // вьюшка для вывода данных
71 return view('employers.info', compact('user_info')); 73 return view('employers.info', compact('user_info'));
72 } 74 }
73 75
74 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { 76 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) {
75 // Все данные через реквест 77 // Все данные через реквест
76 $all = $request->all(); 78 $all = $request->all();
77 unset($all['_token']); 79 unset($all['_token']);
78 // обновление 80 // обновление
79 $user->update($all); 81 $user->update($all);
80 return redirect()->route('employer.employer_info'); 82 return redirect()->route('employer.employer_info');
81 } 83 }
82 84
83 public function cabinet() { 85 public function cabinet() {
84 $id = Auth()->user()->id; 86 $id = Auth()->user()->id;
85 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 87 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
86 WhereHas('users', 88 WhereHas('users',
87 function (Builder $query) use ($id) {$query->Where('id', $id); 89 function (Builder $query) use ($id) {$query->Where('id', $id);
88 })->get(); 90 })->get();
89 return view('employers.cabinet45', compact('Employer')); 91 return view('employers.cabinet45', compact('Employer'));
90 } 92 }
91 93
92 public function slider_flot() { 94 public function slider_flot() {
93 $id = Auth()->user()->id; 95 $id = Auth()->user()->id;
94 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 96 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
95 WhereHas('users', 97 WhereHas('users',
96 function (Builder $query) use ($id) {$query->Where('id', $id); 98 function (Builder $query) use ($id) {$query->Where('id', $id);
97 })->get(); 99 })->get();
98 return view('employers.fly-flot', compact('Employer')); 100 return view('employers.fly-flot', compact('Employer'));
99 } 101 }
100 102
101 public function cabinet_save(Employer $Employer, Request $request) { 103 public function cabinet_save(Employer $Employer, Request $request) {
102 $params = $request->all(); 104 $params = $request->all();
103 $params['user_id'] = Auth()->user()->id; 105 $params['user_id'] = Auth()->user()->id;
104 $id = $Employer->id; 106 $id = $Employer->id;
105 107
106 if ($request->has('logo')) { 108 if ($request->has('logo')) {
107 if (!empty($Employer->logo)) { 109 if (!empty($Employer->logo)) {
108 Storage::delete($Employer->logo); 110 Storage::delete($Employer->logo);
109 } 111 }
110 $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); 112 $params['logo'] = $request->file('logo')->store("employer/$id", 'public');
111 } 113 }
112 114
113 $Employer->update($params); 115 $Employer->update($params);
114 116
115 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); 117 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены');
116 } 118 }
117 119
118 public function save_add_flot(FlotRequest $request) { 120 public function save_add_flot(FlotRequest $request) {
119 // отмена 121 // отмена
120 $params = $request->all(); 122 $params = $request->all();
121 123
122 if ($request->has('image')) { 124 if ($request->has('image')) {
123 $params['image'] = $request->file('image')->store("flot", 'public'); 125 $params['image'] = $request->file('image')->store("flot", 'public');
124 } 126 }
125 Flot::create($params); 127 Flot::create($params);
126 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); 128 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get();
127 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 129 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
128 } 130 }
129 131
130 public function edit_flot(Flot $Flot, Employer $Employer) { 132 public function edit_flot(Flot $Flot, Employer $Employer) {
131 return view('employers.edit-flot', compact('Flot', 'Employer')); 133 return view('employers.edit-flot', compact('Flot', 'Employer'));
132 } 134 }
133 135
134 public function update_flot(FlotRequest $request, Flot $Flot) { 136 public function update_flot(FlotRequest $request, Flot $Flot) {
135 $params = $request->all(); 137 $params = $request->all();
136 138
137 if ($request->has('image')) { 139 if ($request->has('image')) {
138 if (!empty($flot->image)) { 140 if (!empty($flot->image)) {
139 Storage::delete($flot->image); 141 Storage::delete($flot->image);
140 } 142 }
141 $params['image'] = $request->file('image')->store("flot", 'public'); 143 $params['image'] = $request->file('image')->store("flot", 'public');
142 } else { 144 } else {
143 if (!empty($flot->image)) $params['image'] = $flot->image; 145 if (!empty($flot->image)) $params['image'] = $flot->image;
144 } 146 }
145 147
146 $Flot->update($params); 148 $Flot->update($params);
147 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 149 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
148 } 150 }
149 151
150 public function delete_flot(Flot $Flot) { 152 public function delete_flot(Flot $Flot) {
151 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); 153 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get();
152 154
153 if (isset($Flot->id)) $Flot->delete(); 155 if (isset($Flot->id)) $Flot->delete();
154 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); 156 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален');
155 } 157 }
156 158
157 // Форма добавления вакансий 159 // Форма добавления вакансий
158 public function cabinet_vacancie() { 160 public function cabinet_vacancie() {
159 $id = Auth()->user()->id; 161 $id = Auth()->user()->id;
160 162
161 if (Auth()->user()->is_public) { 163 if (Auth()->user()->is_public) {
162 $categories = Category::query()->active()->get(); 164 $categories = Category::query()->active()->get();
163 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 165 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
164 where('is_remove', '=', '0')-> 166 where('is_remove', '=', '0')->
165 where('is_bd', '=', '0')-> 167 where('is_bd', '=', '0')->
166 get(); 168 get();
167 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 169 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
168 WhereHas('users', 170 WhereHas('users',
169 function (Builder $query) use ($id) { 171 function (Builder $query) use ($id) {
170 $query->Where('id', $id); 172 $query->Where('id', $id);
171 })->get(); 173 })->get();
172 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); 174 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories'));
173 } else { 175 } else {
174 return redirect()->route('employer.cabinet_vacancie_danger'); 176 return redirect()->route('employer.cabinet_vacancie_danger');
175 } 177 }
176 } 178 }
177 179
178 // Форма предупреждения об оплате 180 // Форма предупреждения об оплате
179 public function cabinet_vacancie_danger() { 181 public function cabinet_vacancie_danger() {
180 return view('employers.add_vacancy_danger'); 182 return view('employers.add_vacancy_danger');
181 } 183 }
182 184
183 // Сохранение вакансии 185 // Сохранение вакансии
184 public function cabinet_vacancy_save1(VacancyRequestEdit $request) { 186 public function cabinet_vacancy_save1(VacancyRequestEdit $request) {
185 $params_emp = $request->all(); 187 $params_emp = $request->all();
186 188
187 $params_job["job_title_id"] = $params_emp['job_title_id']; 189 $params_job["job_title_id"] = $params_emp['job_title_id'];
188 //$params_job["min_salary"] = $params_emp['min_salary']; 190 //$params_job["min_salary"] = $params_emp['min_salary'];
189 //$params_job["max_salary"] = $params_emp['max_salary']; 191 //$params_job["max_salary"] = $params_emp['max_salary'];
190 //$params_job["region"] = $params_emp['region']; 192 //$params_job["region"] = $params_emp['region'];
191 //$params_job["power"] = $params_emp['power']; 193 //$params_job["power"] = $params_emp['power'];
192 //$params_job["sytki"] = $params_emp['sytki']; 194 //$params_job["sytki"] = $params_emp['sytki'];
193 //$params_job["start"] = $params_emp['start']; 195 //$params_job["start"] = $params_emp['start'];
194 //$params_job["flot"] = $params_emp['flot']; 196 //$params_job["flot"] = $params_emp['flot'];
195 //$params_job["description"] = $params_emp['description']; 197 //$params_job["description"] = $params_emp['description'];
196 198
197 $ad_jobs = Ad_employer::create($params_emp); 199 $ad_jobs = Ad_employer::create($params_emp);
198 //$params_job['ad_employer_id'] = $ad_jobs->id; 200 //$params_job['ad_employer_id'] = $ad_jobs->id;
199 //Ad_jobs::create($params_job); 201 //Ad_jobs::create($params_job);
200 $ad_jobs->jobs()->sync($request->get('job_title_id')); 202 $ad_jobs->jobs()->sync($request->get('job_title_id'));
201 203
202 return redirect()->route('employer.vacancy_list'); 204 return redirect()->route('employer.vacancy_list');
203 } 205 }
204 206
205 // Список вакансий 207 // Список вакансий
206 public function vacancy_list(Request $request) { 208 public function vacancy_list(Request $request) {
207 $id = Auth()->user()->id; 209 $id = Auth()->user()->id;
208 210
209 //dd($request->all()); 211 //dd($request->all());
210 $Employer = Employer::query()->where('user_id', $id)->first(); 212 $Employer = Employer::query()->where('user_id', $id)->first();
211 $vacancy_list = Ad_employer::query() 213 $vacancy_list = Ad_employer::query()
212 ->with('jobs') 214 ->with('jobs')
213 ->with('jobs_code') 215 ->with('jobs_code')
214 ->where('employer_id', $Employer->id) 216 ->where('employer_id', $Employer->id)
215 ->where('is_remove', 0) 217 ->where('is_remove', 0)
216 ->orderbyDesc('updated_at') 218 ->orderbyDesc('updated_at')
217 ; 219 ;
218 220
219 if (($request->has('search')) && (!empty($request->get('search')))) { 221 if (($request->has('search')) && (!empty($request->get('search')))) {
220 $search = $request->get('search'); 222 $search = $request->get('search');
221 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); 223 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%");
222 } 224 }
223 225
224 if ($request->get('sort')) { 226 if ($request->get('sort')) {
225 $sort = $request->get('sort'); 227 $sort = $request->get('sort');
226 switch ($sort) { 228 switch ($sort) {
227 case 'nopublic': $vacancy_list->where('active_is', '=', 0);break; 229 case 'nopublic': $vacancy_list->where('active_is', '=', 0);break;
228 case 'public':$vacancy_list->where('active_is', '=', 1);break; 230 case 'public':$vacancy_list->where('active_is', '=', 1);break;
229 default: $vacancy_list = $vacancy_list->orderByDesc('id'); break; 231 default: $vacancy_list = $vacancy_list->orderByDesc('id'); break;
230 } 232 }
231 } else { 233 } else {
232 $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); 234 $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id');
233 } 235 }
234 236
235 $vacancy_list = $vacancy_list->paginate(10); 237 $vacancy_list = $vacancy_list->paginate(10);
236 238
237 //ajax 239 //ajax
238 if ($request->ajax()) { 240 if ($request->ajax()) {
239 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); 241 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer'));
240 } else { 242 } else {
241 return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); 243 return view('employers.list_vacancy', compact('vacancy_list', 'Employer'));
242 } 244 }
243 } 245 }
244 246
245 // Карточка вакансии 247 // Карточка вакансии
246 public function vacancy_edit(Ad_employer $ad_employer) { 248 public function vacancy_edit(Ad_employer $ad_employer) {
247 $id = Auth()->user()->id; 249 $id = Auth()->user()->id;
248 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 250 $Positions = Category::query()->where('is_remove', '=', '0')->get();
249 251
250 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 252 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
251 where('is_remove', '=', '0')-> 253 where('is_remove', '=', '0')->
252 where('is_bd', '=', '0')->get(); 254 where('is_bd', '=', '0')->get();
253 255
254 $Employer = Employer::query()->with('users')->with('ads')-> 256 $Employer = Employer::query()->with('users')->with('ads')->
255 with('flots')->where('user_id', $id)->first(); 257 with('flots')->where('user_id', $id)->first();
256 258
257 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); 259 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs'));
258 } 260 }
259 261
260 // Сохранение-редактирование записи 262 // Сохранение-редактирование записи
261 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { 263 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) {
262 $params = $request->all(); 264 $params = $request->all();
263 $params_job["job_title_id"] = $params['job_title_id']; 265 $params_job["job_title_id"] = $params['job_title_id'];
264 266
265 $ad_employer->update($params); 267 $ad_employer->update($params);
266 $ad_employer->jobs()->sync($request->get('job_title_id')); 268 $ad_employer->jobs()->sync($request->get('job_title_id'));
267 269
268 $id = Auth()->user()->id; 270 $id = Auth()->user()->id;
269 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 271 $Positions = Category::query()->where('is_remove', '=', '0')->get();
270 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') 272 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')
271 ->where('is_remove', '=', '0') 273 ->where('is_remove', '=', '0')
272 ->where('is_bd', '=', '0') 274 ->where('is_bd', '=', '0')
273 ->get(); 275 ->get();
274 276
275 $Employer = Employer::query() 277 $Employer = Employer::query()
276 ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); 278 ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first();
277 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); 279 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs'));
278 } 280 }
279 281
280 // Сохранение карточки вакансии 282 // Сохранение карточки вакансии
281 public function vacancy_save(Request $request, Ad_employer $ad_employer) { 283 public function vacancy_save(Request $request, Ad_employer $ad_employer) {
282 $all = $request->all(); 284 $all = $request->all();
283 $ad_employer->update($all); 285 $ad_employer->update($all);
284 return redirect()->route('employer.cabinet_vacancie'); 286 return redirect()->route('employer.cabinet_vacancie');
285 } 287 }
286 288
287 // Удаление карточки вакансии 289 // Удаление карточки вакансии
288 public function vacancy_delete(Ad_employer $ad_employer) { 290 public function vacancy_delete(Ad_employer $ad_employer) {
289 $ad_employer->delete(); 291 $ad_employer->delete();
290 292
291 return redirect()->route('employer.vacancy_list') 293 return redirect()->route('employer.vacancy_list')
292 ->with('success', 'Данные были успешно сохранены'); 294 ->with('success', 'Данные были успешно сохранены');
293 } 295 }
294 296
295 // Обновление даты 297 // Обновление даты
296 public function vacancy_up(Ad_employer $ad_employer) { 298 public function vacancy_up(Ad_employer $ad_employer) {
297 $up = date('m/d/Y h:i:s', time());; 299 $up = date('m/d/Y h:i:s', time());;
298 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 300 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
299 $vac_emp->updated_at = $up; 301 $vac_emp->updated_at = $up;
300 $vac_emp->save(); 302 $vac_emp->save();
301 303
302 return redirect()->back(); //route('employer.vacancy_list'); 304 return redirect()->back(); //route('employer.vacancy_list');
303 // начало конца 305 // начало конца
304 } 306 }
305 307
306 //Видимость вакансии 308 //Видимость вакансии
307 public function vacancy_eye(Ad_employer $ad_employer, $status) { 309 public function vacancy_eye(Ad_employer $ad_employer, $status) {
308 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 310 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
309 $vac_emp->active_is = $status; 311 $vac_emp->active_is = $status;
310 $vac_emp->save(); 312 $vac_emp->save();
311 313
312 return redirect()->route('employer.vacancy_list'); 314 return redirect()->route('employer.vacancy_list');
313 } 315 }
314 316
315 //Вакансия редактирования (шаблон) 317 //Вакансия редактирования (шаблон)
316 public function vacancy_update(Ad_employer $id) { 318 public function vacancy_update(Ad_employer $id) {
317 319
318 } 320 }
319 321
320 //Отклики на вакансию - лист 322 //Отклики на вакансию - лист
321 public function answers(Employer $employer, Request $request) { 323 public function answers(Employer $employer, Request $request) {
322 $user_id = Auth()->user()->id; 324 $user_id = Auth()->user()->id;
323 $answer = Ad_employer::query()->where('employer_id', $employer->id); 325 $answer = Ad_employer::query()->where('employer_id', $employer->id);
324 if ($request->has('search')) { 326 if ($request->has('search')) {
325 $search = trim($request->get('search')); 327 $search = trim($request->get('search'));
326 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); 328 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%");
327 } 329 }
328 330
329 $answer = $answer->with('response')->OrderByDESC('id')->get(); 331 $answer = $answer->with('response')->OrderByDESC('id')->get();
330 332
331 return view('employers.list_answer', compact('answer', 'user_id', 'employer')); 333 return view('employers.list_answer', compact('answer', 'user_id', 'employer'));
332 } 334 }
333 335
334 //Обновление статуса 336 //Обновление статуса
335 public function supple_status(employer $employer, ad_response $ad_response, $flag) { 337 public function supple_status(employer $employer, ad_response $ad_response, $flag) {
336 $ad_response->update(Array('flag' => $flag)); 338 $ad_response->update(Array('flag' => $flag));
337 return redirect()->route('employer.answers', ['employer' => $employer->id]); 339 return redirect()->route('employer.answers', ['employer' => $employer->id]);
338 } 340 }
339 341
340 //Страницы сообщений список 342 //Страницы сообщений список
341 public function messages($type_message) { 343 public function messages($type_message) {
342 $user_id = Auth()->user()->id; 344 $user_id = Auth()->user()->id;
343 345
344 $chats = Chat::get_user_chats($user_id); 346 $chats = Chat::get_user_chats($user_id);
345 $user_type = 'employer'; 347 $user_type = 'employer';
346 $admin_chat = false; 348 $admin_chat = false;
347 349
348 return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type')); 350 return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type'));
349 } 351 }
350 352
351 // Диалог между пользователями 353 // Диалог между пользователями
352 public function dialog(Chat $chat, Request $request) { 354 public function dialog(Chat $chat, Request $request) {
353 // Получение параметров. 355 // Получение параметров.
354 if ($request->has('ad_employer')){ 356 if ($request->has('ad_employer')){
355 $ad_employer = $request->get('ad_employer'); 357 $ad_employer = $request->get('ad_employer');
356 } else { 358 } else {
357 $ad_employer = 0; 359 $ad_employer = 0;
358 } 360 }
359 361
360 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); 362 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first();
361 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); 363 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first();
362 364
363 $Messages = Chat::get_chat_messages($chat); 365 $Messages = Chat::get_chat_messages($chat);
364 366
365 Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]); 367 Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]);
366 368
367 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); 369 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages'));
368 } 370 }
369 371
370 public function pin_chat(Request $request){ 372 public function pin_chat(Request $request){
371 $chat_id = $request->get('id'); 373 $chat_id = $request->get('id');
372 $is_fixed = $request->get('is_fixed'); 374 $is_fixed = $request->get('is_fixed');
373 375
374 Chat::pin_chat($chat_id, $is_fixed); 376 Chat::pin_chat($chat_id, $is_fixed);
375 } 377 }
376 378
377 public function remove_chat(Request $request){ 379 public function remove_chat(Request $request){
378 $chat_id = $request->get('id'); 380 $chat_id = $request->get('id');
379 Chat::remove_chat($chat_id); 381 Chat::remove_chat($chat_id);
380 } 382 }
381 383
382 // Регистрация работодателя 384 // Регистрация работодателя
383 public function register_employer(Request $request) { 385 public function register_employer(Request $request) {
384 $params = $request->all(); 386 $params = $request->all();
385 387
386 $rules = [ 388 $rules = [
387 //'surname' => ['required', 'string', 'max:255'], 389 //'surname' => ['required', 'string', 'max:255'],
388 //'name_man' => ['required', 'string', 'max:255'], 390 //'name_man' => ['required', 'string', 'max:255'],
389 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 391 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
390 'name_company' => ['required', 'string', 'max:255'], 392 'name_company' => ['required', 'string', 'max:255'],
391 'password' => ['required', 'string', 'min:6'], 393 'password' => ['required', 'string', 'min:6'],
392 ]; 394 ];
393 395
394 396
395 $messages = [ 397 $messages = [
396 'required' => 'Укажите обязательное поле', 398 'required' => 'Укажите обязательное поле',
397 'min' => [ 399 'min' => [
398 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 400 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
399 'integer' => 'Поле «:attribute» должно быть :min или больше', 401 'integer' => 'Поле «:attribute» должно быть :min или больше',
400 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 402 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
401 ], 403 ],
402 'max' => [ 404 'max' => [
403 'string' => 'Поле «:attribute» должно быть не больше :max символов', 405 'string' => 'Поле «:attribute» должно быть не больше :max символов',
404 'integer' => 'Поле «:attribute» должно быть :max или меньше', 406 'integer' => 'Поле «:attribute» должно быть :max или меньше',
405 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 407 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
406 ] 408 ]
407 ]; 409 ];
408 410
409 $email = $request->get('email'); 411 $email = $request->get('email');
410 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { 412 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
411 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); 413 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
412 } 414 }
413 415
414 if ($request->get('password') !== $request->get('confirmed')){ 416 if ($request->get('password') !== $request->get('confirmed')){
415 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 417 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
416 } 418 }
417 419
418 if (strlen($request->get('password')) < 6) { 420 if (strlen($request->get('password')) < 6) {
419 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 421 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
420 } 422 }
421 423
422 if (empty($request->get('surname'))) { 424 if (empty($request->get('surname'))) {
423 $params['surname'] = 'Неизвестно'; 425 $params['surname'] = 'Неизвестно';
424 } 426 }
425 if (empty($request->get('name_man'))) { 427 if (empty($request->get('name_man'))) {
426 $params['name_man'] = 'Неизвестно'; 428 $params['name_man'] = 'Неизвестно';
427 } 429 }
428 $validator = Validator::make($params, $rules, $messages); 430 $validator = Validator::make($params, $rules, $messages);
429 431
430 if ($validator->fails()) { 432 if ($validator->fails()) {
431 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 433 return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
432 } else { 434 } else {
433 $user = $this->create($params); 435 $user = $this->create($params);
434 event(new Registered($user)); 436 event(new Registered($user));
435 437
436 Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); 438 Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params));
437 439
438 Auth::guard()->login($user); 440 Auth::guard()->login($user);
439 } 441 }
440 442
441 if ($user) { 443 if ($user) {
442 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; 444 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));;
443 } else { 445 } else {
444 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 446 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
445 } 447 }
446 } 448 }
447 449
448 // Создание пользователя 450 // Создание пользователя
449 protected function create(array $data) 451 protected function create(array $data)
450 { 452 {
451 $Use = new User_Model(); 453 $Use = new User_Model();
452 $Code_user = $Use->create([ 454 $Code_user = $Use->create([
453 'name' => $data['surname']." ".$data['name_man'], 455 'name' => $data['surname']." ".$data['name_man'],
454 'name_man' => $data['name_man'], 456 'name_man' => $data['name_man'],
455 'surname' => $data['surname'], 457 'surname' => $data['surname'],
456 'surname2' => $data['surname2'], 458 'surname2' => $data['surname2'],
457 'subscribe_email' => $data['email'], 459 'subscribe_email' => $data['email'],
458 'email' => $data['email'], 460 'email' => $data['email'],
459 'telephone' => $data['telephone'], 461 'telephone' => $data['telephone'],
460 'is_worker' => 0, 462 'is_worker' => 0,
461 'password' => Hash::make($data['password']), 463 'password' => Hash::make($data['password']),
462 'pubpassword' => base64_encode($data['password']), 464 'pubpassword' => base64_encode($data['password']),
463 'email_verified_at' => Carbon::now() 465 'email_verified_at' => Carbon::now()
464 ]); 466 ]);
465 467
466 if ($Code_user->id > 0) { 468 if ($Code_user->id > 0) {
467 $Employer = new Employer(); 469 $Employer = new Employer();
468 $Employer->user_id = $Code_user->id; 470 $Employer->user_id = $Code_user->id;
469 $Employer->name_company = $data['name_company']; 471 $Employer->name_company = $data['name_company'];
470 $Employer->email = $data['email']; 472 $Employer->email = $data['email'];
471 $Employer->telephone = $data['telephone']; 473 $Employer->telephone = $data['telephone'];
472 $Employer->code = Tools::generator_id(10); 474 $Employer->code = Tools::generator_id(10);
473 $Employer->save(); 475 $Employer->save();
474 476
475 return $Code_user; 477 return $Code_user;
476 } 478 }
477 } 479 }
478 480
479 // Отправка сообщения от работодателя 481 // Отправка сообщения от работодателя
480 public function send_message(MessagesRequiest $request) { 482 public function send_message(MessagesRequiest $request) {
481 $params = $request->all(); 483 $params = $request->all();
482 dd($params); 484 dd($params);
483 $user1 = $params['user_id']; 485 $user1 = $params['user_id'];
484 $user2 = $params['to_user_id']; 486 $user2 = $params['to_user_id'];
485 487
486 if ($request->has('file')) { 488 if ($request->has('file')) {
487 $params['file'] = $request->file('file')->store("messages", 'public'); 489 $params['file'] = $request->file('file')->store("messages", 'public');
488 } 490 }
489 Message::create($params); 491 Message::create($params);
490 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 492 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
491 } 493 }
492 494
493 public function test123(Request $request) { 495 public function test123(Request $request) {
494 $params = $request->all(); 496 $params = $request->all();
495 $user1 = $params['user_id']; 497 $user1 = $params['user_id'];
496 $user2 = $params['to_user_id']; 498 $user2 = $params['to_user_id'];
497 499
498 $rules = [ 500 $rules = [
499 'text' => 'nullable|required_without:file|min:1|max:150000', 501 'text' => 'nullable|required_without:file|min:1|max:150000',
500 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 502 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
501 ]; 503 ];
502 $messages = [ 504 $messages = [
503 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', 505 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен',
504 'min' => [ 506 'min' => [
505 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 507 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
506 'integer' => 'Поле «:attribute» должно быть :min или больше', 508 'integer' => 'Поле «:attribute» должно быть :min или больше',
507 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 509 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
508 ], 510 ],
509 'max' => [ 511 'max' => [
510 'string' => 'Поле «:attribute» должно быть не больше :max символов', 512 'string' => 'Поле «:attribute» должно быть не больше :max символов',
511 'integer' => 'Поле «:attribute» должно быть :max или меньше', 513 'integer' => 'Поле «:attribute» должно быть :max или меньше',
512 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 514 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
513 ] 515 ]
514 ]; 516 ];
515 517
516 $validator = Validator::make($request->all(), $rules, $messages); 518 $validator = Validator::make($request->all(), $rules, $messages);
517 519
518 if ($validator->fails()) { 520 if ($validator->fails()) {
519 $chat = Chat::where('user_id', $user1) 521 $chat = Chat::where('user_id', $user1)
520 ->where('to_user_id', $user2) 522 ->where('to_user_id', $user2)
521 ->where('is_removed', 0) 523 ->where('is_removed', 0)
522 ->first() 524 ->first()
523 ; 525 ;
524 if ($chat->id){ 526 if ($chat->id){
525 return redirect()->route('employer.dialog', ['chat' => $chat->id])->withErrors($validator); 527 return redirect()->route('employer.dialog', ['chat' => $chat->id])->withErrors($validator);
526 } else { 528 } else {
527 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); 529 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator);
528 } 530 }
529 531
530 } else { 532 } else {
531 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); 533 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages');
532 534
533 return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]); 535 return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]);
534 536
535 } 537 }
536 } 538 }
537 539
538 //Избранные люди 540 //Избранные люди
539 public function favorites(Request $request) { 541 public function favorites(Request $request) {
540 $IP_address = RusDate::ip_addr_client(); 542 $IP_address = RusDate::ip_addr_client();
541 $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); 543 $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get();
542 544
543 if ($Arr->count()) { 545 if ($Arr->count()) {
544 $A = Array(); 546 $A = Array();
545 foreach ($Arr as $it) { 547 foreach ($Arr as $it) {
546 $A[] = $it->code_record; 548 $A[] = $it->code_record;
547 } 549 }
548 550
549 $Workers = Worker::query()->whereIn('id', $A); 551 $Workers = Worker::query()->whereIn('id', $A);
550 } else { 552 } else {
551 $Workers = Worker::query()->where('id', '=', '0'); 553 $Workers = Worker::query()->where('id', '=', '0');
552 } 554 }
553 555
554 if (($request->has('search')) && (!empty($request->get('search')))) { 556 if (($request->has('search')) && (!empty($request->get('search')))) {
555 $search = $request->get('search'); 557 $search = $request->get('search');
556 558
557 $Workers = $Workers->WhereHas('users', 559 $Workers = $Workers->WhereHas('users',
558 function (Builder $query) use ($search) { 560 function (Builder $query) use ($search) {
559 $query->Where('surname', 'LIKE', "%$search%") 561 $query->Where('surname', 'LIKE', "%$search%")
560 ->orWhere('name_man', 'LIKE', "%$search%") 562 ->orWhere('name_man', 'LIKE', "%$search%")
561 ->orWhere('surname2', 'LIKE', "%$search%"); 563 ->orWhere('surname2', 'LIKE', "%$search%");
562 }); 564 });
563 } else { 565 } else {
564 $Workers = $Workers->with('users'); 566 $Workers = $Workers->with('users');
565 } 567 }
566 568
567 $Workers = $Workers->get(); 569 $Workers = $Workers->get();
568 570
569 571
570 return view('employers.favorite', compact('Workers')); 572 return view('employers.favorite', compact('Workers'));
571 } 573 }
572 574
573 // База данных 575 // База данных
574 public function bd(Request $request) { 576 public function bd(Request $request) {
575 $users = User_Model::query()->with('workers')->with('jobtitles'); 577 $users = User_Model::query()->with('workers')->with('jobtitles');
576 578
577 if ($request->has('search')) { 579 if ($request->has('search')) {
578 $find_key = $request->get('search'); 580 $find_key = $request->get('search');
579 $users = $users->where('name', 'LIKE', "%$find_key%") 581 $users = $users->where('name', 'LIKE', "%$find_key%")
580 ->orWhere('surname', 'LIKE', "%$find_key%") 582 ->orWhere('surname', 'LIKE', "%$find_key%")
581 ->orWhere('name_man', 'LIKE', "%$find_key%") 583 ->orWhere('name_man', 'LIKE', "%$find_key%")
582 ->orWhere('email', 'LIKE', "%$find_key%") 584 ->orWhere('email', 'LIKE', "%$find_key%")
583 ->orWhere('telephone', 'LIKE', "%$find_key%"); 585 ->orWhere('telephone', 'LIKE', "%$find_key%");
584 } 586 }
585 587
586 // Данные 588 // Данные
587 $users = $users->Baseuser()-> 589 $users = $users->Baseuser()->
588 orderByDesc(Worker::select('created_at')->whereColumn('workers.user_id', 'users.id')); 590 orderByDesc(Worker::select('created_at')->whereColumn('workers.user_id', 'users.id'));
589 $count_users = $users; 591 $count_users = $users;
590 $users = $users->paginate(5); 592 $users = $users->paginate(5);
591 593
592 $export_options = DbExportColumns::toArray(); 594 $export_options = DbExportColumns::toArray();
593 595
594 $jobs_titles = Job_title::select('id', 'name') 596 $jobs_titles = Job_title::select('id', 'name')
595 ->where('is_remove', '=', 0) 597 ->where('is_remove', '=', 0)
596 ->where('is_bd', '=', 2) 598 ->where('is_bd', '=', 2)
597 ->orderByDesc('sort') 599 ->orderByDesc('sort')
598 ->orderBy('name', 'asc') 600 ->orderBy('name', 'asc')
599 ->get() 601 ->get()
600 ->toArray() 602 ->toArray()
601 ; 603 ;
602 604
603 return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); 605 return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles'));
604 } 606 }
605 607
606 //Настройка уведомлений 608 //Настройка уведомлений
607 public function subscribe() { 609 public function subscribe() {
608 return view('employers.subcribe'); 610 return view('employers.subcribe');
609 } 611 }
610 612
611 //Установка уведомлений сохранение 613 //Установка уведомлений сохранение
612 public function save_subscribe(Request $request) { 614 public function save_subscribe(Request $request) {
613 dd($request->all()); 615 dd($request->all());
614 $msg = $request->validate([ 616 $msg = $request->validate([
615 'subscribe_email' => 'required|email|min:5|max:255', 617 'subscribe_email' => 'required|email|min:5|max:255',
616 ]); 618 ]);
617 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); 619 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку');
618 } 620 }
619 621
620 //Сбросить форму с паролем 622 //Сбросить форму с паролем
621 public function password_reset() { 623 public function password_reset() {
622 $email = Auth()->user()->email; 624 $email = Auth()->user()->email;
623 return view('employers.password-reset', compact('email')); 625 return view('employers.password-reset', compact('email'));
624 } 626 }
625 627
626 //Обновление пароля 628 //Обновление пароля
627 public function new_password(Request $request) { 629 public function new_password(Request $request) {
628 $use = Auth()->user(); 630 $use = Auth()->user();
629 $request->validate([ 631 $request->validate([
630 'password' => 'required|string', 632 'password' => 'required|string',
631 'new_password' => 'required|string', 633 'new_password' => 'required|string',
632 'new_password2' => 'required|string' 634 'new_password2' => 'required|string'
633 ]); 635 ]);
634 636
635 if ($request->get('new_password') == $request->get('new_password2')) 637 if ($request->get('new_password') == $request->get('new_password2'))
636 if ($request->get('password') !== $request->get('new_password')) { 638 if ($request->get('password') !== $request->get('new_password')) {
637 $credentials = $request->only('email', 'password'); 639 $credentials = $request->only('email', 'password');
638 if (Auth::attempt($credentials)) { 640 if (Auth::attempt($credentials)) {
639 641
640 if (!is_null($use->email_verified_at)){ 642 if (!is_null($use->email_verified_at)){
641 643
642 $user_data = User_Model::find($use->id); 644 $user_data = User_Model::find($use->id);
643 $user_data->update([ 645 $user_data->update([
644 'password' => Hash::make($request->get('new_password')), 646 'password' => Hash::make($request->get('new_password')),
645 'pubpassword' => base64_encode($request->get('new_password')), 647 'pubpassword' => base64_encode($request->get('new_password')),
646 ]); 648 ]);
647 return redirect() 649 return redirect()
648 ->route('employer.password_reset') 650 ->route('employer.password_reset')
649 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 651 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
650 } 652 }
651 653
652 return redirect() 654 return redirect()
653 ->route('employer.password_reset') 655 ->route('employer.password_reset')
654 ->withError('Данная учетная запись не было верифицированна!'); 656 ->withError('Данная учетная запись не было верифицированна!');
655 } 657 }
656 } 658 }
657 659
658 return redirect() 660 return redirect()
659 ->route('employer.password_reset') 661 ->route('employer.password_reset')
660 ->withErrors('Не совпадение данных, обновите пароли!'); 662 ->withErrors('Не совпадение данных, обновите пароли!');
661 } 663 }
662 664
663 665
664 666
665 // Форма Удаление пипла 667 // Форма Удаление пипла
666 public function delete_people() { 668 public function delete_people() {
667 $login = Auth()->user()->email; 669 $login = Auth()->user()->email;
668 return view('employers.delete_people', compact('login')); 670 return view('employers.delete_people', compact('login'));
669 } 671 }
670 672
671 // Удаление аккаунта 673 // Удаление аккаунта
672 public function action_delete_user(Request $request) { 674 public function action_delete_user(Request $request) {
673 $Answer = $request->all(); 675 $Answer = $request->all();
674 $user_id = Auth()->user()->id; 676 $user_id = Auth()->user()->id;
675 $request->validate([ 677 $request->validate([
676 'password' => 'required|string', 678 'password' => 'required|string',
677 ]); 679 ]);
678 680
679 $credentials = $request->only('email', 'password'); 681 $credentials = $request->only('email', 'password');
680 if (Auth::attempt($credentials)) { 682 if (Auth::attempt($credentials)) {
681 Auth::logout(); 683 Auth::logout();
682 $it = User_Model::find($user_id); 684 $it = User_Model::find($user_id);
683 $it->delete(); 685 $it->delete();
684 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 686 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
685 } else { 687 } else {
686 return redirect()->route('employer.delete_people') 688 return redirect()->route('employer.delete_people')
687 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 689 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
688 } 690 }
689 } 691 }
690 692
691 public function ajax_delete_user(Request $request) { 693 public function ajax_delete_user(Request $request) {
692 $Answer = $request->all(); 694 $Answer = $request->all();
693 $user_id = Auth()->user()->id; 695 $user_id = Auth()->user()->id;
694 $request->validate([ 696 $request->validate([
695 'password' => 'required|string', 697 'password' => 'required|string',
696 ]); 698 ]);
697 $credentials = $request->only('email', 'password'); 699 $credentials = $request->only('email', 'password');
698 if (Auth::attempt($credentials)) { 700 if (Auth::attempt($credentials)) {
699 701
700 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', 702 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт',
701 'email' => $request->get('email'), 703 'email' => $request->get('email'),
702 'password' => $request->get('password'))); 704 'password' => $request->get('password')));
703 } else { 705 } else {
704 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); 706 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль'));
705 } 707 }
706 } 708 }
707 709
708 // FAQ - Вопросы/ответы для работодателей и соискателей 710 // FAQ - Вопросы/ответы для работодателей и соискателей
709 public function faq() { 711 public function faq() {
710 return view('employers.faq'); 712 return view('employers.faq');
711 } 713 }
712 714
713 // Рассылка сообщений 715 // Рассылка сообщений
714 public function send_all_messages() { 716 public function send_all_messages() {
715 $id = Auth()->user()->id; 717 $id = Auth()->user()->id;
716 $sending = Employer::query()->where('user_id', '=', "$id")->first(); 718 $sending = Employer::query()->where('user_id', '=', "$id")->first();
717 719
718 $job_titles = Job_title::query() 720 $job_titles = Job_title::query()
719 ->where('is_remove', '=', 0) 721 ->where('is_remove', '=', 0)
720 ->where('is_bd', '=', 1) 722 //->where('is_bd', '=', 1)
721 ->orderByDesc('sort') 723 ->orderByDesc('sort')
722 ->get() 724 ->get();
723 ;
724 725
725 if ($sending->sending_is) 726 if ($sending->sending_is)
726 return view('employers.send_all', compact('job_titles')); 727 return view('employers.send_all', compact('job_titles'));
727 else 728 else
728 return view('employers.send_all_danger'); 729 return view('employers.send_all_danger');
729 } 730 }
730 731
731 // Отправка сообщений для информации 732 // Отправка сообщений для информации
732 public function send_all_post(Request $request) { 733 public function send_all_post(Request $request) {
733 $data = $request->all(); 734 $data = $request->all();
734 $data['user'] = Auth()->user(); 735 $data['user'] = Auth()->user();
735 736
736 $id = MessagesRequests::create([ 737 $id = MessagesRequests::create([
737 'user_id' => Auth()->user()->id, 738 'user_id' => Auth()->user()->id,
738 'job_titles' => json_encode($data['job_title_ids']), 739 'job_titles' => json_encode($data['job_title_ids']),
739 'text' => $data['message_text'], 740 'text' => $data['message_text'],
740 ]); 741 ]);
741 742
742 if (!empty($id)){ 743 try {
743 Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data)); 744 if (!empty($id)) {
745 Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data));
746 }
747 } catch (Throwable $e) {
748 Log::error($e);
749 return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее');
744 } 750 }
745 751
746 /*$emails = User_Model::query()->where('is_worker', '1')->get();
747
748 foreach ($emails as $e) {
749 Mail::to($e->email)->send(new SendAllMessages($data));
750 }*/
751
752 return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.'); 752 return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.');
753 } 753 }
754 754
755 // База резюме 755 // База резюме
756 public function bd_tupe(Request $request) { 756 public function bd_tupe(Request $request) {
757 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); 757 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get();
758 758
759 return view('employers.bd_tupe', compact('Resume')); 759 return view('employers.bd_tupe', compact('Resume'));
760 } 760 }
761 761
762 ////////////////////////////////////////////////////////////////// 762 //////////////////////////////////////////////////////////////////
763 // Отправил сообщение 763 // Отправил сообщение
764 ////////////////////////////////////////////////////////////////// 764 //////////////////////////////////////////////////////////////////
765 public function new_message(Request $request) { 765 public function new_message(Request $request) {
766 $params = $request->all(); 766 $params = $request->all();
767 767
768 $id = $params['_user_id']; 768 $id = $params['_user_id'];
769 $message_params = [ 769 $message_params = [
770 'title' => $params['title'], 770 'title' => $params['title'],
771 'text' => $params['text'], 771 'text' => $params['text'],
772 'ad_employer_id' => $params['_vacancy'], 772 'ad_employer_id' => $params['_vacancy'],
773 'flag_new' => 1 773 'flag_new' => 1
774 ]; 774 ];
775 775
776 Message::add_message( 776 Message::add_message(
777 $request, 777 $request,
778 $params['_user_id'], 778 $params['_user_id'],
779 $params['_to_user_id'], 779 $params['_to_user_id'],
780 $message_params, 780 $message_params,
781 file_store_path: "worker/$id" 781 file_store_path: "worker/$id"
782 ); 782 );
783 783
784 return redirect()->route('employer.messages', ['type_message' => 'output']); 784 return redirect()->route('employer.messages', ['type_message' => 'output']);
785 } 785 }
786 786
787 // Восстановление пароля 787 // Восстановление пароля
788 public function repair_password(Request $request) { 788 public function repair_password(Request $request) {
789 $params = $request->get('email'); 789 $params = $request->get('email');
790 } 790 }
791 791
792 // Избранные люди на корабль 792 // Избранные люди на корабль
793 public function selected_people(Request $request) { 793 public function selected_people(Request $request) {
794 $id = $request->get('id'); 794 $id = $request->get('id');
795 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 795 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
796 where('is_remove', '=', '0')-> 796 where('is_remove', '=', '0')->
1 <?php 1 <?php
2 2
3 namespace App\Http; 3 namespace App\Http;
4 4
5 use App\Http\Middleware\IsAdmin;
6 use App\Http\Middleware\IsUserEmployer;
7 use App\Http\Middleware\IsUserWorker;
5 use Illuminate\Foundation\Http\Kernel as HttpKernel; 8 use Illuminate\Foundation\Http\Kernel as HttpKernel;
6 9
7 class Kernel extends HttpKernel 10 class Kernel extends HttpKernel
8 { 11 {
9 /** 12 /**
10 * The application's global HTTP middleware stack. 13 * The application's global HTTP middleware stack.
11 * 14 *
12 * These middleware are run during every request to your application. 15 * These middleware are run during every request to your application.
13 * 16 *
14 * @var array<int, class-string|string> 17 * @var array<int, class-string|string>
15 */ 18 */
16 protected $middleware = [ 19 protected $middleware = [
17 // \App\Http\Middleware\TrustHosts::class, 20 // \App\Http\Middleware\TrustHosts::class,
18 \App\Http\Middleware\TrustProxies::class, 21 \App\Http\Middleware\TrustProxies::class,
19 \Illuminate\Http\Middleware\HandleCors::class, 22 \Illuminate\Http\Middleware\HandleCors::class,
20 \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 23 \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
21 \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 24 \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
22 \App\Http\Middleware\TrimStrings::class, 25 \App\Http\Middleware\TrimStrings::class,
23 \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 26 \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
24 ]; 27 ];
25 28
26 /** 29 /**
27 * The application's route middleware groups. 30 * The application's route middleware groups.
28 * 31 *
29 * @var array<string, array<int, class-string|string>> 32 * @var array<string, array<int, class-string|string>>
30 */ 33 */
31 protected $middlewareGroups = [ 34 protected $middlewareGroups = [
32 'web' => [ 35 'web' => [
33 \App\Http\Middleware\EncryptCookies::class, 36 \App\Http\Middleware\EncryptCookies::class,
34 \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 37 \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
35 \Illuminate\Session\Middleware\StartSession::class, 38 \Illuminate\Session\Middleware\StartSession::class,
36 \Illuminate\View\Middleware\ShareErrorsFromSession::class, 39 \Illuminate\View\Middleware\ShareErrorsFromSession::class,
37 \App\Http\Middleware\VerifyCsrfToken::class, 40 \App\Http\Middleware\VerifyCsrfToken::class,
38 \Illuminate\Routing\Middleware\SubstituteBindings::class, 41 \Illuminate\Routing\Middleware\SubstituteBindings::class,
39 ], 42 ],
40 43
41 'api' => [ 44 'api' => [
42 // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 45 // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
43 'throttle:api', 46 'throttle:api',
44 \Illuminate\Routing\Middleware\SubstituteBindings::class, 47 \Illuminate\Routing\Middleware\SubstituteBindings::class,
45 ], 48 ],
46 ]; 49 ];
47 50
48 /** 51 /**
49 * The application's route middleware. 52 * The application's route middleware.
50 * 53 *
51 * These middleware may be assigned to groups or used individually. 54 * These middleware may be assigned to groups or used individually.
52 * 55 *
53 * @var array<string, class-string|string> 56 * @var array<string, class-string|string>
54 */ 57 */
55 protected $routeMiddleware = [ 58 protected $routeMiddleware = [
56 'auth' => \App\Http\Middleware\Authenticate::class, 59 'auth' => \App\Http\Middleware\Authenticate::class,
57 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 60 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
58 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 61 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
59 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 62 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
60 'can' => \Illuminate\Auth\Middleware\Authorize::class, 63 'can' => \Illuminate\Auth\Middleware\Authorize::class,
61 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 64 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
62 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 65 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
63 'signed' => \App\Http\Middleware\ValidateSignature::class, 66 'signed' => \App\Http\Middleware\ValidateSignature::class,
64 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 67 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
65 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 68 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
69 'is_worker' => IsUserWorker::class,
70 'is_employer' => IsUserEmployer::class,
71 'admin' => IsAdmin::class
66 ]; 72 ];
67 } 73 }
68 74
app/Http/Middleware/IsAdmin.php
File was created 1 <?php
2
3 namespace App\Http\Middleware;
4
5 use App\Providers\RouteServiceProvider;
6 use Closure;
7 use Illuminate\Http\Request;
8 use Illuminate\Support\Facades\Auth;
9
10 class IsAdmin
11 {
12 public function handle(Request $request, Closure $next)
13 {
14 if (Auth::user()->is_admin === 1) {
15 return redirect(RouteServiceProvider::HOME);
16 }
17 return $next($request);
18 }
19 }
20
app/Http/Middleware/IsUserEmployer.php
File was created 1 <?php
2
3 namespace App\Http\Middleware;
4
5 use App\Providers\RouteServiceProvider;
6 use Closure;
7 use Illuminate\Http\Request;
8 use Illuminate\Support\Facades\Auth;
9
10 class IsUserEmployer
11 {
12 public function handle(Request $request, Closure $next)
13 {
14 if (Auth::user()->is_worker === 1) {
15 return redirect(RouteServiceProvider::HOME);
16 }
17 return $next($request);
18 }
19 }
20
app/Http/Middleware/IsUserWorker.php
File was created 1 <?php
2
3 namespace App\Http\Middleware;
4
5 use App\Providers\RouteServiceProvider;
6 use Closure;
7 use Illuminate\Http\Request;
8 use Illuminate\Support\Facades\Auth;
9
10 class IsUserWorker
11 {
12 public function handle(Request $request, Closure $next)
13 {
14 if (Auth::user()->is_worker !== 1) {
15 return redirect(RouteServiceProvider::HOME);
16 }
17 return $next($request);
18 }
19 }
20
app/Providers/RouteServiceProvider.php
1 <?php 1 <?php
2 2
3 namespace App\Providers; 3 namespace App\Providers;
4 4
5 use Illuminate\Cache\RateLimiting\Limit; 5 use Illuminate\Cache\RateLimiting\Limit;
6 use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; 6 use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
7 use Illuminate\Http\Request; 7 use Illuminate\Http\Request;
8 use Illuminate\Support\Facades\RateLimiter; 8 use Illuminate\Support\Facades\RateLimiter;
9 use Illuminate\Support\Facades\Route; 9 use Illuminate\Support\Facades\Route;
10 10
11 class RouteServiceProvider extends ServiceProvider 11 class RouteServiceProvider extends ServiceProvider
12 { 12 {
13 /** 13 /**
14 * The path to the "home" route for your application. 14 * The path to the "home" route for your application.
15 * 15 *
16 * Typically, users are redirected here after authentication. 16 * Typically, users are redirected here after authentication.
17 * 17 *
18 * @var string 18 * @var string
19 */ 19 */
20 public const HOME = '/home'; 20 public const HOME = '/';
21 21
22 public const LOGIN = '/login'; 22 public const LOGIN = '/';
23 23
24 /** 24 /**
25 * Define your route model bindings, pattern filters, and other route configuration. 25 * Define your route model bindings, pattern filters, and other route configuration.
26 * 26 *
27 * @return void 27 * @return void
28 */ 28 */
29 public function boot() 29 public function boot()
30 { 30 {
31 $this->configureRateLimiting(); 31 $this->configureRateLimiting();
32 32
33 $this->routes(function () { 33 $this->routes(function () {
34 Route::middleware('api') 34 Route::middleware('api')
35 ->prefix('api') 35 ->prefix('api')
36 ->group(base_path('routes/api.php')); 36 ->group(base_path('routes/api.php'));
37 37
38 Route::middleware('web') 38 Route::middleware('web')
39 ->group(base_path('routes/web.php')); 39 ->group(base_path('routes/web.php'));
40 }); 40 });
41 } 41 }
42 42
43 /** 43 /**
44 * Configure the rate limiters for the application. 44 * Configure the rate limiters for the application.
45 * 45 *
46 * @return void 46 * @return void
47 */ 47 */
48 protected function configureRateLimiting() 48 protected function configureRateLimiting()
49 { 49 {
50 RateLimiter::for('api', function (Request $request) { 50 RateLimiter::for('api', function (Request $request) {
51 return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 51 return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
52 }); 52 });
53 } 53 }
54 } 54 }
55 55
resources/views/chats/chats_list.blade.php
1 <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
2 <meta http-equiv="Pragma" content="no-cache">
3 <meta http-equiv="Expires" content="0">
4
5
6 @if ($chats->count() || $admin_chat) 1 @if ($chats->count() || $admin_chat)
7 @csrf 2 @csrf
8 3
9 @if($admin_chat) 4 @if($admin_chat)
10 <div class="messages__item hover-shadow admin-chat-wrap"> 5 <div class="messages__item hover-shadow admin-chat-wrap">
11 <a class="messages__item-info" href="{{ route($user_type . '.dialog', ['chat' => $admin_chat->id]) }}"> 6 <a class="messages__item-info" href="{{ route($user_type . '.dialog', ['chat' => $admin_chat->id]) }}">
12 @include('svg.logo_icon') 7 @include('svg.logo_icon')
13 <div class="messages__item-text"> 8 <div class="messages__item-text">
14 <div> 9 <div>
15 <b>Администратор сайта</b> 10 <b>Администратор сайта</b>
16 </div> 11 </div>
17 <div> 12 <div>
18 {{ $admin_chat->last_message->text }} 13 {{ $admin_chat->last_message->text }}
19 </div> 14 </div>
20 </div> 15 </div>
21 </a> 16 </a>
22 17
23 <div class="messages__item-actions" data-chat-id="{{ $admin_chat->id }}"> 18 <div class="messages__item-actions" data-chat-id="{{ $admin_chat->id }}">
24 <div class="messages__item-date max-content">{{ date(' H:i, d.m.Y', strtotime($admin_chat->created_at)) }}</div> 19 <div class="messages__item-date max-content">{{ date(' H:i, d.m.Y', strtotime($admin_chat->created_at)) }}</div>
25 <div class="messages__item-buttons"> 20 <div class="messages__item-buttons">
26 @if($admin_chat->admin_chat_unread_messages_count > 0) 21 @if($admin_chat->admin_chat_unread_messages_count > 0)
27 <div class="unread-messages-count mr-15">{{ $admin_chat->admin_chat_unread_messages_count }}</div> 22 <div class="unread-messages-count mr-15">{{ $admin_chat->admin_chat_unread_messages_count }}</div>
28 @endif 23 @endif
29 </div> 24 </div>
30 </div> 25 </div>
31 </div> 26 </div>
32 @endif 27 @endif
33 28
34 @if ($chats->count()) 29 @if ($chats->count())
35 @foreach($chats as $chat) 30 @foreach($chats as $chat)
36 <div class="messages__item hover-shadow {{ intval($chat->is_fixed) == 1 ? 'chat-fixed' : '' }}"> 31 <div class="messages__item hover-shadow {{ intval($chat->is_fixed) == 1 ? 'chat-fixed' : '' }}">
37 <a class="messages__item-info" href="{{ route($user_type . '.dialog', ['chat' => $chat->id]) }}"> 32 <a class="messages__item-info" href="{{ route($user_type . '.dialog', ['chat' => $chat->id]) }}">
38 <div class="messages__item-photo"> 33 <div class="messages__item-photo">
39 @if (isset($chat->employer->logo)) 34 @if (isset($chat->employer->logo))
40 <img src="{{ asset(Storage::url($chat->employer->logo)) }}" alt=""> 35 <img src="{{ asset(Storage::url($chat->employer->logo)) }}" alt="">
41 @elseif(isset($chat->worker->photo)) 36 @elseif(isset($chat->worker->photo))
42 <img src="{{ asset(Storage::url($chat->worker->photo)) }}" alt=""> 37 <img src="{{ asset(Storage::url($chat->worker->photo)) }}" alt="">
43 @else 38 @else
44 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 39 <img src="{{ asset('images/default_man.jpg') }}" alt="">
45 @endif 40 @endif
46 </div> 41 </div>
47 <div class="messages__item-text"> 42 <div class="messages__item-text">
48 <div> 43 <div>
49 <b id="chat_name"> 44 <b id="chat_name">
50 @if ($chat->employer && $chat->employer->name_company) 45 @if ($chat->employer && $chat->employer->name_company)
51 {{ $chat->employer->name_company }} 46 {{ $chat->employer->name_company }}
52 @else 47 @else
53 {{ $chat->user->surname . ' ' . $chat->user->name_man . ' ' . $chat->user->surname2 }} 48 {{ $chat->user->surname . ' ' . $chat->user->name_man . ' ' . $chat->user->surname2 }}
54 @endif 49 @endif
55 </b> 50 </b>
56 </div> 51 </div>
57 <div> 52 <div>
58 {{ $chat->last_message->text }} 53 {{ $chat->last_message->text }}
59 </div> 54 </div>
60 </div> 55 </div>
61 </a> 56 </a>
62 57
63 <div class="messages__item-actions" data-chat-id="{{ $chat->id }}"> 58 <div class="messages__item-actions" data-chat-id="{{ $chat->id }}">
64 <div class="messages__item-date max-content">{{ date(' H:i, d.m.Y', strtotime($chat->created_at)) }}</div> 59 <div class="messages__item-date max-content">{{ date(' H:i, d.m.Y', strtotime($chat->created_at)) }}</div>
65 <div class="messages__item-buttons"> 60 <div class="messages__item-buttons">
66 @if($chat->unread_messages_count > 0) 61 @if($chat->unread_messages_count > 0)
67 <div class="unread-messages-count mr-15">{{ $chat->unread_messages_count }}</div> 62 <div class="unread-messages-count mr-15">{{ $chat->unread_messages_count }}</div>
68 @endif 63 @endif
69 64
70 <button class="pin-chat {{ intval($chat->is_fixed) == 1 ? 'pin-on' : 'pin-off' }} mr-15"> 65 <button class="pin-chat {{ intval($chat->is_fixed) == 1 ? 'pin-on' : 'pin-off' }} mr-15">
71 @include('svg.pin_off') 66 @include('svg.pin_off')
72 </button> 67 </button>
73 <button class="remove-chat" data-user="{{ $chat->user_id }}" data-fancybox data-src="#remove_chat"> 68 <button class="remove-chat" data-user="{{ $chat->user_id }}" data-fancybox data-src="#remove_chat">
74 <svg> 69 <svg>
75 <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> 70 <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use>
76 </svg> 71 </svg>
77 </button> 72 </button>
78 </div> 73 </div>
79 <div class="clear"></div> 74 <div class="clear"></div>
80 </div> 75 </div>
81 </div> 76 </div>
82 @endforeach 77 @endforeach
83 <div style="margin-top: 20px"> 78 <div style="margin-top: 20px">
84 {{ $chats->onEachSide(0)->appends($_GET)->links('paginate') }} 79 {{ $chats->onEachSide(0)->appends($_GET)->links('paginate') }}
85 </div><!-- конец --> 80 </div><!-- конец -->
86 @endif 81 @endif
87 @else 82 @else
88 <div class="notify"> 83 <div class="notify">
89 <svg> 84 <svg>
90 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> 85 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
91 </svg> 86 </svg>
92 <span>Сообщений не найдено</span> 87 <span>Сообщений не найдено</span>
93 </div> 88 </div>
94 @endif 89 @endif
95 90
96 <script> 91 <script>
97 $(function (){ 92 $(function (){
98 $('.pin-chat').click(function(){ 93 $('.pin-chat').click(function(){
99 var this_btn = $(this); 94 var this_btn = $(this);
100 var chat_id = this_btn.closest('.messages__item-actions').data('chat-id'); 95 var chat_id = this_btn.closest('.messages__item-actions').data('chat-id');
101 var $is_fixed = this_btn.hasClass('pin-on') ? 0 : 1; 96 var $is_fixed = this_btn.hasClass('pin-on') ? 0 : 1;
102 97
103 $.ajax({ 98 $.ajax({
104 type: "POST", 99 type: "POST",
105 url: "{{ route('employer.pin_chat') }}", 100 url: "{{ route('employer.pin_chat') }}",
106 data: { 101 data: {
107 id: chat_id, 102 id: chat_id,
108 is_fixed: $is_fixed 103 is_fixed: $is_fixed
109 }, 104 },
110 headers: { 105 headers: {
111 'X-CSRF-TOKEN': $('[name="_token"]').val() 106 'X-CSRF-TOKEN': $('[name="_token"]').val()
112 }, 107 },
113 success: function(){ 108 success: function(){
114 location.reload(); 109 location.reload();
115 } 110 }
116 }); 111 });
117 }); 112 });
118 113
119 $('.remove-chat').click(function(){ 114 $('.remove-chat').click(function(){
120 var this_btn = $(this); 115 var this_btn = $(this);
121 var chat_id = this_btn.closest('.messages__item-actions').data('chat-id'); 116 var chat_id = this_btn.closest('.messages__item-actions').data('chat-id');
122 var wrap = this_btn.closest('.messages__item'); 117 var wrap = this_btn.closest('.messages__item');
123 var target = wrap.find('.messages__item-text').find('#chat_name').text(); 118 var target = wrap.find('.messages__item-text').find('#chat_name').text();
124 119
125 $('#remove_chat').data('chat-id', chat_id); 120 $('#remove_chat').data('chat-id', chat_id);
126 $('#remove_chat').find('.target-chat').text(target.trim()); 121 $('#remove_chat').find('.target-chat').text(target.trim());
127 }); 122 });
128 }); 123 });
129 </script> 124 </script>
130 125
1 <?php 1 <?php
2 2
3 use App\Http\Controllers\Ad_jobsController; 3 use App\Http\Controllers\Ad_jobsController;
4 use App\Http\Controllers\AdEmployerController; 4 use App\Http\Controllers\AdEmployerController;
5 use App\Http\Controllers\Admin\AdminController; 5 use App\Http\Controllers\Admin\AdminController;
6 use App\Http\Controllers\Admin\CategoryController; 6 use App\Http\Controllers\Admin\CategoryController;
7 use App\Http\Controllers\Admin\CategoryEmpController; 7 use App\Http\Controllers\Admin\CategoryEmpController;
8 use App\Http\Controllers\Admin\EducationController; 8 use App\Http\Controllers\Admin\EducationController;
9 use App\Http\Controllers\EducationController as EducationFrontController; 9 use App\Http\Controllers\EducationController as EducationFrontController;
10 use App\Http\Controllers\Admin\EmployersController; 10 use App\Http\Controllers\Admin\EmployersController;
11 use App\Http\Controllers\EmployerController as FrontEmployersController; 11 use App\Http\Controllers\EmployerController as FrontEmployersController;
12 use App\Http\Controllers\Admin\InfoBloksController; 12 use App\Http\Controllers\Admin\InfoBloksController;
13 use App\Http\Controllers\Admin\JobTitlesController; 13 use App\Http\Controllers\Admin\JobTitlesController;
14 use App\Http\Controllers\Admin\UsersController; 14 use App\Http\Controllers\Admin\UsersController;
15 use App\Http\Controllers\Admin\WorkersController; 15 use App\Http\Controllers\Admin\WorkersController;
16 use App\Http\Controllers\Auth\ForgotPasswordController; 16 use App\Http\Controllers\Auth\ForgotPasswordController;
17 use App\Http\Controllers\Auth\LoginController; 17 use App\Http\Controllers\Auth\LoginController;
18 use App\Http\Controllers\Auth\RegisterController; 18 use App\Http\Controllers\Auth\RegisterController;
19 use App\Http\Controllers\CKEditorController; 19 use App\Http\Controllers\CKEditorController;
20 use App\Http\Controllers\MediaController; 20 use App\Http\Controllers\MediaController;
21 use App\Http\Controllers\WorkerController; 21 use App\Http\Controllers\WorkerController;
22 use App\Models\Ad_jobs; 22 use App\Models\Ad_jobs;
23 use App\Models\User; 23 use App\Models\User;
24 use App\Http\Controllers\MainController; 24 use App\Http\Controllers\MainController;
25 use App\Http\Controllers\HomeController; 25 use App\Http\Controllers\HomeController;
26 use Illuminate\Support\Facades\Route; 26 use Illuminate\Support\Facades\Route;
27 use App\Http\Controllers\Admin\CompanyController; 27 use App\Http\Controllers\Admin\CompanyController;
28 use App\Http\Controllers\Admin\Ad_EmployersController; 28 use App\Http\Controllers\Admin\Ad_EmployersController;
29 use App\Http\Controllers\Admin\MsgAnswersController; 29 use App\Http\Controllers\Admin\MsgAnswersController;
30 use App\Http\Controllers\Admin\GroupsController; 30 use App\Http\Controllers\Admin\GroupsController;
31 use App\Http\Controllers\PagesController; 31 use App\Http\Controllers\PagesController;
32 use Illuminate\Support\Facades\Storage; 32 use Illuminate\Support\Facades\Storage;
33 use App\Http\Controllers\EmployerController; 33 use App\Http\Controllers\EmployerController;
34 use App\Http\Controllers\CompanyController as FrontCompanyController; 34 use App\Http\Controllers\CompanyController as FrontCompanyController;
35 35
36 36
37 /* 37 /*
38 |-------------------------------------------------------------------------- 38 |--------------------------------------------------------------------------
39 | Web Routes 39 | Web Routes
40 |-------------------------------------------------------------------------- 40 |--------------------------------------------------------------------------
41 | 41 |
42 | Here is where you can register web routes for your application. These 42 | Here is where you can register web routes for your application. These
43 | routes are loaded by the RouteServiceProvider within a group which 43 | routes are loaded by the RouteServiceProvider within a group which
44 | contains the "web" middleware group. Now create something great! 44 | contains the "web" middleware group. Now create something great!
45 | 45 |
46 */ 46 */
47 /* 47 /*
48 Route::get('/', function () { 48 Route::get('/', function () {
49 return view('welcome'); 49 return view('welcome');
50 })->name('index'); 50 })->name('index');
51 */ 51 */
52 52
53 Route::get('/', [MainController::class, 'index'])->name('index'); 53 Route::get('/', [MainController::class, 'index'])->name('index');
54 54
55 //Роуты авторизации, регистрации, восстановления, аутентификации 55 //Роуты авторизации, регистрации, восстановления, аутентификации
56 Auth::routes(['verify' => true]); 56 Auth::routes(['verify' => true]);
57 57
58 // роуты регистрации, авторизации, восстановления пароля, верификации почты 58 // роуты регистрации, авторизации, восстановления пароля, верификации почты
59 /*Route::group([ 59 /*Route::group([
60 'as' => 'auth.', //имя маршрута, например auth.index 60 'as' => 'auth.', //имя маршрута, например auth.index
61 'prefix' => 'auth', // префикс маршрута, например, auth/index 61 'prefix' => 'auth', // префикс маршрута, например, auth/index
62 ], function () { 62 ], function () {
63 //форма регистрации 63 //форма регистрации
64 Route::get('register', [RegisterController::class, 'register'])->name('register'); 64 Route::get('register', [RegisterController::class, 'register'])->name('register');
65 65
66 //создание пользователя 66 //создание пользователя
67 Route::post('register', [RegisterController::class, 'create'])->name('create'); 67 Route::post('register', [RegisterController::class, 'create'])->name('create');
68 68
69 //форма входа авторизации 69 //форма входа авторизации
70 Route::get('login', [LoginController::class, 'login'])->name('login'); 70 Route::get('login', [LoginController::class, 'login'])->name('login');
71 71
72 //аутентификация 72 //аутентификация
73 Route::post('login', [LoginController::class, 'authenticate'])->name('auth'); 73 Route::post('login', [LoginController::class, 'authenticate'])->name('auth');
74 74
75 //выход 75 //выход
76 Route::get('logout', [LoginController::class, 'logout'])->name('logout'); 76 Route::get('logout', [LoginController::class, 'logout'])->name('logout');
77 77
78 //форма ввода адреса почты 78 //форма ввода адреса почты
79 Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form'); 79 Route::get('forgot-password', [ForgotPasswordController::class, 'form'])->name('forgot-form');
80 80
81 //письмо на почту 81 //письмо на почту
82 Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail'); 82 Route::post('forgot-password', [ForgotPasswordController::class, 'mail'])->name('forgot-mail');
83 83
84 //форма восстановления пароля 84 //форма восстановления пароля
85 Route::get('reset-password/token/{token}/email/{email}', 85 Route::get('reset-password/token/{token}/email/{email}',
86 [ResetPasswordController::class, 'form'] 86 [ResetPasswordController::class, 'form']
87 )->name('reset-form'); 87 )->name('reset-form');
88 88
89 //восстановление пароля 89 //восстановление пароля
90 Route::post('reset-password', 90 Route::post('reset-password',
91 [ResetPasswordController::class, 'reset'] 91 [ResetPasswordController::class, 'reset']
92 )->name('reset-password'); 92 )->name('reset-password');
93 93
94 //сообщение о необходимости проверки адреса почты 94 //сообщение о необходимости проверки адреса почты
95 Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message'); 95 Route::get('verify-message', [VerifyEmailController::class, 'message'])->name('verify-message');
96 96
97 //подтверждение адреса почты нового пользователя 97 //подтверждение адреса почты нового пользователя
98 Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify']) 98 Route::get('verify-email/token/{token}/id/{id}', [VerifyEmailController::class, 'verify'])
99 ->where('token', '[a-f0-9]{32}') 99 ->where('token', '[a-f0-9]{32}')
100 ->where('id', '[0-9]+') 100 ->where('id', '[0-9]+')
101 ->name('verify-email'); 101 ->name('verify-email');
102 });*/ 102 });*/
103 103
104 //Личный кабинет пользователя 104 //Личный кабинет пользователя
105 Route::get('/home', [HomeController::class, 'index'])->name('home'); 105 Route::get('/home', [HomeController::class, 'index'])->name('home');
106 106
107 /* 107 /*
108 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) { 108 Route::post('resend/verification-email', function (\Illuminate\Http\Request $request) {
109 $user = User::where('email',$request->input('email'))->first(); 109 $user = User::where('email',$request->input('email'))->first();
110 110
111 $user->sendEmailVerificationNotification(); 111 $user->sendEmailVerificationNotification();
112 112
113 return 'your response'; 113 return 'your response';
114 })->middleware('throttle:6,1')->name('verification.resend'); 114 })->middleware('throttle:6,1')->name('verification.resend');
115 */ 115 */
116 116
117 // Авторизация, регистрация в админку 117 // Авторизация, регистрация в админку
118 Route::group([ 118 Route::group([
119 'as' => 'admin.', // имя маршрута, например auth.index 119 'as' => 'admin.', // имя маршрута, например auth.index
120 'prefix' => 'admin', // префикс маршрута, например auth/index 120 'prefix' => 'admin', // префикс маршрута, например auth/index
121 'middleware' => ['guest'], 121 'middleware' => ['guest'],
122 ], function () { 122 ], function () {
123 // Форма регистрации 123 // Форма регистрации
124 Route::get('register', [AdminController::class, 'register'])->name('register'); 124 Route::get('register', [AdminController::class, 'register'])->name('register');
125 // Создание пользователя 125 // Создание пользователя
126 Route::post('register', [AdminController::class, 'create'])->name('create'); 126 Route::post('register', [AdminController::class, 'create'])->name('create');
127 127
128 //Форма входа 128 //Форма входа
129 Route::get('login', [AdminController::class, 'login'])->name('login'); 129 Route::get('login', [AdminController::class, 'login'])->name('login');
130 130
131 // аутентификация 131 // аутентификация
132 Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); 132 Route::post('login', [AdminController::class, 'autenticate'])->name('auth');
133 133
134 }); 134 });
135 135
136 // Личный кабинет админки 136 // Личный кабинет админки
137 Route::group([ 137 Route::group([
138 'as' => 'admin.', // имя маршрута, например auth.index 138 'as' => 'admin.', // имя маршрута, например auth.index
139 'prefix' => 'admin', // префикс маршрута, например auth/index 139 'prefix' => 'admin', // префикс маршрута, например auth/index
140 'middleware' => ['auth'], ['admin'], 140 'middleware' => ['auth', 'admin'],
141 ], function() { 141 ], function() {
142 142
143 // выход 143 // выход
144 Route::get('logout', [AdminController::class, 'logout'])->name('logout'); 144 Route::get('logout', [AdminController::class, 'logout'])->name('logout');
145 145
146 // кабинет главная страница 146 // кабинет главная страница
147 Route::get('cabinet', [AdminController::class, 'index'])->name('index'); 147 Route::get('cabinet', [AdminController::class, 'index'])->name('index');
148 148
149 // кабинет профиль админа - форма 149 // кабинет профиль админа - форма
150 Route::get('profile', [AdminController::class, 'profile'])->name('profile'); 150 Route::get('profile', [AdminController::class, 'profile'])->name('profile');
151 // кабинет профиль админа - сохранение формы 151 // кабинет профиль админа - сохранение формы
152 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); 152 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile');
153 153
154 //кабинет сообщения админа 154 //кабинет сообщения админа
155 //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); 155 //Route::get('messages', [AdminController::class, 'profile'])->name('profile');
156 156
157 157
158 // кабинет профиль - форма пароли 158 // кабинет профиль - форма пароли
159 Route::get('password', [AdminController::class, 'profile_password'])->name('password'); 159 Route::get('password', [AdminController::class, 'profile_password'])->name('password');
160 // кабинет профиль - сохранение формы пароля 160 // кабинет профиль - сохранение формы пароля
161 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); 161 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password');
162 162
163 163
164 // кабинет профиль пользователя - форма 164 // кабинет профиль пользователя - форма
165 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); 165 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile');
166 // кабинет профиль пользователя - сохранение формы 166 // кабинет профиль пользователя - сохранение формы
167 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); 167 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile');
168 168
169 // кабинет профиль работодатель - форма 169 // кабинет профиль работодатель - форма
170 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); 170 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile');
171 // кабинет профиль работодатель - сохранение формы 171 // кабинет профиль работодатель - сохранение формы
172 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); 172 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile');
173 // кабинет удаление профиль работодателя и юзера 173 // кабинет удаление профиль работодателя и юзера
174 Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); 174 Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer');
175 175
176 // кабинет профиль работник - форма 176 // кабинет профиль работник - форма
177 Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); 177 Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add');
178 Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); 178 Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store');
179 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); 179 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit');
180 // кабинет профиль работник - сохранение формы 180 // кабинет профиль работник - сохранение формы
181 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); 181 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update');
182 182
183 // Медиа 183 // Медиа
184 Route::get('media', [MediaController::class, 'index'])->name('media'); 184 Route::get('media', [MediaController::class, 'index'])->name('media');
185 Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); 185 Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media');
186 186
187 // кабинет настройки сайта - форма 187 // кабинет настройки сайта - форма
188 Route::get('config', [AdminController::class, 'config_form'])->name('config'); 188 Route::get('config', [AdminController::class, 'config_form'])->name('config');
189 // кабинет настройки сайта сохранение формы 189 // кабинет настройки сайта сохранение формы
190 Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); 190 Route::post('config', [AdminController::class, 'store_config'])->name('store_config');
191 191
192 // кабинет - новости 192 // кабинет - новости
193 Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin'); 193 Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin');
194 Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add'); 194 Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add');
195 Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add'); 195 Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add');
196 Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit'); 196 Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit');
197 Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update'); 197 Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update');
198 Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete'); 198 Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete');
199 199
200 // кабинет - пользователи 200 // кабинет - пользователи
201 Route::get('users', [UsersController::class, 'index'])->name('users'); 201 Route::get('users', [UsersController::class, 'index'])->name('users');
202 Route::get('user-delete/{user}', [UsersController::class, 'user_delete'])->name('user_delete'); 202 Route::get('user-delete/{user}', [UsersController::class, 'user_delete'])->name('user_delete');
203 203
204 // кабинет - пользователи 204 // кабинет - пользователи
205 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); 205 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users');
206 206
207 // кабинет - работодатели 207 // кабинет - работодатели
208 Route::get('employers', [EmployersController::class, 'index'])->name('employers'); 208 Route::get('employers', [EmployersController::class, 'index'])->name('employers');
209 209
210 Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer'); 210 Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer');
211 211
212 Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add'); 212 Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add');
213 Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save'); 213 Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save');
214 Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot'); 214 Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot');
215 Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit'); 215 Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit');
216 Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete'); 216 Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete');
217 217
218 // кабинет - соискатели 218 // кабинет - соискатели
219 Route::get('workers', [WorkersController::class, 'index'])->name('workers'); 219 Route::get('workers', [WorkersController::class, 'index'])->name('workers');
220 220
221 // кабинет - база данных 221 // кабинет - база данных
222 Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata'); 222 Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata');
223 Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata'); 223 Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata');
224 Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata'); 224 Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata');
225 Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata'); 225 Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata');
226 Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata'); 226 Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata');
227 Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata'); 227 Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata');
228 Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata'); 228 Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata');
229 229
230 // кабинет - вакансии 230 // кабинет - вакансии
231 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); 231 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers');
232 Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers'); 232 Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers');
233 Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers'); 233 Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers');
234 Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); 234 Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers');
235 Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); 235 Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers');
236 Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer'); 236 Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer');
237 237
238 // Редактирование должности в вакансии 238 // Редактирование должности в вакансии
239 Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs'); 239 Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs');
240 Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs'); 240 Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs');
241 241
242 242
243 // кабинет - категории 243 // кабинет - категории
244 //Route::get('categories', [AdminController::class, 'index'])->name('categories'); 244 //Route::get('categories', [AdminController::class, 'index'])->name('categories');
245 245
246 // СRUD-операции над Справочником Категории 246 // СRUD-операции над Справочником Категории
247 247
248 Route::resource('categories', CategoryController::class, ['except' => ['show']]); 248 Route::resource('categories', CategoryController::class, ['except' => ['show']]);
249 249
250 // CRUD-операции над справочником Категории для работодателей 250 // CRUD-операции над справочником Категории для работодателей
251 Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]); 251 Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]);
252 252
253 // CRUD-операции над справочником Образование 253 // CRUD-операции над справочником Образование
254 Route::resource('education', EducationController::class, ['except' => ['show']]); 254 Route::resource('education', EducationController::class, ['except' => ['show']]);
255 255
256 Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education'); 256 Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education');
257 Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); 257 Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education');
258 Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); 258 Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education');
259 259
260 Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education'); 260 Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education');
261 Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education'); 261 Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education');
262 262
263 Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education'); 263 Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education');
264 264
265 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); 265 //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles');
266 /* 266 /*
267 * кабинет - CRUD-операции по справочнику должности 267 * кабинет - CRUD-операции по справочнику должности
268 * 268 *
269 */ 269 */
270 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); 270 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]);
271 271
272 // кабинет - сообщения (чтение чужих) 272 // кабинет - сообщения (чтение чужих)
273 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); 273 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages');
274 // кабинет - просмотр сообщения чужого (чтение) 274 // кабинет - просмотр сообщения чужого (чтение)
275 Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message'); 275 Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message');
276 276
277 // кабинет - сообщения (админские) 277 // кабинет - сообщения (админские)
278 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); 278 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages');
279 // кабинет - сообщения (админские) 279 // кабинет - сообщения (админские)
280 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); 280 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post');
281 // кабинет - sql - конструкция запросов 281 // кабинет - sql - конструкция запросов
282 Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql'); 282 Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql');
283 283
284 Route::post('admin-reject-message', [MsgAnswersController::class, 'reject_message'])->name('reject_message'); 284 Route::post('admin-reject-message', [MsgAnswersController::class, 'reject_message'])->name('reject_message');
285 Route::post('admin-send-message', [MsgAnswersController::class, 'send_message'])->name('send_message'); 285 Route::post('admin-send-message', [MsgAnswersController::class, 'send_message'])->name('send_message');
286 286
287 /* 287 /*
288 * Расписанный подход в описании каждой директорий групп пользователей. 288 * Расписанный подход в описании каждой директорий групп пользователей.
289 */ 289 */
290 // кабинет - группы пользователей 290 // кабинет - группы пользователей
291 Route::get('groups', [GroupsController::class, 'index'])->name('groups'); 291 Route::get('groups', [GroupsController::class, 'index'])->name('groups');
292 // кабинет - добавление форма группы пользователей 292 // кабинет - добавление форма группы пользователей
293 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); 293 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group');
294 // кабинет - сохранение формы группы пользователей 294 // кабинет - сохранение формы группы пользователей
295 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); 295 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store');
296 // кабинет - редактирование форма группы пользователей 296 // кабинет - редактирование форма группы пользователей
297 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); 297 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group');
298 // кабинет - сохранение редактированной формы группы пользователей 298 // кабинет - сохранение редактированной формы группы пользователей
299 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); 299 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group');
300 // кабинет - удаление группы пользователей 300 // кабинет - удаление группы пользователей
301 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); 301 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group');
302 302
303 303
304 // кабинет - список админов 304 // кабинет - список админов
305 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); 305 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin');
306 306
307 // справочник Позиции 307 // справочник Позиции
308 Route::get('positions', [AdminController::class, 'position'])->name('position'); 308 Route::get('positions', [AdminController::class, 'position'])->name('position');
309 Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position'); 309 Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position');
310 Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position'); 310 Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position');
311 Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position'); 311 Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position');
312 Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position'); 312 Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position');
313 Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position'); 313 Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position');
314 314
315 /////редактор////// кабинет - редактор сайта//////////////////////// 315 /////редактор////// кабинет - редактор сайта////////////////////////
316 Route::get('editor-site', function() { 316 Route::get('editor-site', function() {
317 return view('admin.editor.index'); 317 return view('admin.editor.index');
318 })->name('editor-site'); 318 })->name('editor-site');
319 319
320 320
321 // кабинет - редактор шапки-футера сайта 321 // кабинет - редактор шапки-футера сайта
322 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); 322 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks');
323 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); 323 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block');
324 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); 324 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store');
325 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); 325 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block');
326 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); 326 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block');
327 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); 327 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block');
328 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); 328 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block');
329 329
330 330
331 // кабинет - редактор должности на главной 331 // кабинет - редактор должности на главной
332 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); 332 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main');
333 333
334 // кабинет - счетчики на главной 334 // кабинет - счетчики на главной
335 Route::get('counters-main', [CompanyController::class, 'counters_main'])->name('counters-main'); 335 Route::get('counters-main', [CompanyController::class, 'counters_main'])->name('counters-main');
336 Route::post('counters-main/edit/{name}', [CompanyController::class, 'counters_main_update'])->name('counters-main-update'); 336 Route::post('counters-main/edit/{name}', [CompanyController::class, 'counters_main_update'])->name('counters-main-update');
337 337
338 // кабинет - редактор работодатели на главной 338 // кабинет - редактор работодатели на главной
339 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); 339 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main');
340 Route::post('employers-main-add', [CompanyController::class, 'employers_main_add'])->name('employers-main-add'); 340 Route::post('employers-main-add', [CompanyController::class, 'employers_main_add'])->name('employers-main-add');
341 Route::post('employers-main-remove', [CompanyController::class, 'employers_main_remove'])->name('employers-main-remove'); 341 Route::post('employers-main-remove', [CompanyController::class, 'employers_main_remove'])->name('employers-main-remove');
342 342
343 343
344 // кабинет - редактор seo-сайта 344 // кабинет - редактор seo-сайта
345 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); 345 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo');
346 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); 346 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo');
347 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); 347 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store');
348 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); 348 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo');
349 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); 349 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo');
350 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); 350 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo');
351 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); 351 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo');
352 352
353 353
354 // кабинет - редактор страниц 354 // кабинет - редактор страниц
355 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); 355 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages');
356 // кабинет - добавление страницы 356 // кабинет - добавление страницы
357 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); 357 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page');
358 // кабинет - сохранение формы страницы 358 // кабинет - сохранение формы страницы
359 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); 359 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store');
360 // кабинет - редактирование форма страницы 360 // кабинет - редактирование форма страницы
361 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); 361 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page');
362 // кабинет - сохранение редактированной формы страницы 362 // кабинет - сохранение редактированной формы страницы
363 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); 363 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page');
364 // кабинет - удаление страницы 364 // кабинет - удаление страницы
365 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); 365 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page');
366 366
367 367
368 // кабинет - реклама сайта 368 // кабинет - реклама сайта
369 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); 369 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames');
370 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); 370 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames');
371 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); 371 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store');
372 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); 372 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames');
373 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); 373 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames');
374 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); 374 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames');
375 //////////////////////////////////////////////////////////////////////// 375 ////////////////////////////////////////////////////////////////////////
376 376
377 377
378 // кабинет - отзывы о работодателе для модерации 378 // кабинет - отзывы о работодателе для модерации
379 Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); 379 Route::get('answers', [EmployersController::class, 'answers'])->name('answers');
380 380
381 // Общая страница статистики 381 // Общая страница статистики
382 Route::get('statics', function () { 382 Route::get('statics', function () {
383 return view('admin.static.index'); 383 return view('admin.static.index');
384 })->name('statics'); 384 })->name('statics');
385 385
386 // кабинет - статистика работников 386 // кабинет - статистика работников
387 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); 387 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers');
388 388
389 // кабинет - статистика вакансий работодателя 389 // кабинет - статистика вакансий работодателя
390 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); 390 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads');
391 391
392 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника 392 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника
393 /* 393 /*
394 * CRUD-операции над справочником дипломы и документы 394 * CRUD-операции над справочником дипломы и документы
395 */ 395 */
396 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); 396 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks');
397 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); 397 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]);
398 398
399 // кабинет - роли пользователя 399 // кабинет - роли пользователя
400 Route::get('roles', [UsersController::class, 'roles'])->name('roles'); 400 Route::get('roles', [UsersController::class, 'roles'])->name('roles');
401 401
402 Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles'); 402 Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles');
403 403
404 Route::get('logs', function() { 404 Route::get('logs', function() {
405 $files = Storage::files('logs/laravel.log'); 405 $files = Storage::files('logs/laravel.log');
406 })->name('logs'); 406 })->name('logs');
407 }); 407 });
408 408
409 // Инструментальные страницы 409 // Инструментальные страницы
410 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); 410 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload');
411 411
412 Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); 412 Route::get('redis/', [PagesController::class, 'redis'])->name('redis');
413 413
414 Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); 414 Route::get('excel/', [PagesController::class, 'excel'])->name('excel');
415 415
416 // Страницы с произвольным контентом 416 // Страницы с произвольным контентом
417 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); 417 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page');
418 418
419 // Форма обратной связи 419 // Форма обратной связи
420 Route::post('form_feedback', [PagesController::class, 'form_feedback'])->name('form_feedback'); 420 Route::post('form_feedback', [PagesController::class, 'form_feedback'])->name('form_feedback');
421 421
422 // Публичные страницы соискателя 422 // Публичные страницы соискателя
423 Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); 423 Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page');
424 424
425 //Страница вакансии 425 //Страница вакансии
426 Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer'); 426 Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer');
427 427
428 //Вакансии 428 //Вакансии
429 Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies'); 429 Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies');
430 430
431 //Вакансии поиск на главной 431 //Вакансии поиск на главной
432 Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies'); 432 Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies');
433 433
434 //Вакансии категория детальная 434 //Вакансии категория детальная
435 Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); 435 Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies');
436 436
437 // Лайк вакансии 437 // Лайк вакансии
438 Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy'); 438 Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy');
439 439
440 //Детальная страница вакансии - работодателя 440 //Детальная страница вакансии - работодателя
441 Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); 441 Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie');
442 442
443 //Судоходные компании 443 //Судоходные компании
444 Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies'); 444 Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies');
445 445
446 //Детальная инфа о компании 446 //Детальная инфа о компании
447 Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company'); 447 Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company');
448 448
449 //Образование 449 //Образование
450 Route::get('education', [EducationFrontController::class, 'index'])->name('education'); 450 Route::get('education', [EducationFrontController::class, 'index'])->name('education');
451 Route::get('education/{education}', [EducationFrontController::class, 'show'])->name('show_education')->where('education', '[0-9]+');; 451 Route::get('education/{education}', [EducationFrontController::class, 'show'])->name('show_education')->where('education', '[0-9]+');;
452 452
453 //Новости 453 //Новости
454 Route::get('news', [MainController::class, 'news'])->name('news'); 454 Route::get('news', [MainController::class, 'news'])->name('news');
455 Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new'); 455 Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new');
456 456
457 //Контакты 457 //Контакты
458 Route::get('contacts', [MainController::class, 'contacts'])->name('contacts'); 458 Route::get('contacts', [MainController::class, 'contacts'])->name('contacts');
459 459
460 //База резюме 460 //База резюме
461 Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume'); 461 Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume');
462 Route::get('bd_resume_danger', function(){ 462 Route::get('bd_resume_danger', function(){
463 return view('employers.bd_resume_danger'); 463 return view('employers.bd_resume_danger');
464 })->name('bd_resume_danger'); 464 })->name('bd_resume_danger');
465 465
466 Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume'); 466 Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume');
467 467
468 //Анкета соискателя 468 //Анкета соискателя
469 Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile'); 469 Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile');
470 470
471 //Скачать резюме 471 //Скачать резюме
472 Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download'); 472 Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download');
473 Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2'); 473 Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2');
474 Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all'); 474 Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all');
475 475
476 476
477 //Вход в кабинет 477 //Вход в кабинет
478 Route::get('login', [MainController::class, 'input_login'])->name('login'); 478 Route::get('login', [MainController::class, 'input_login'])->name('login');
479 479
480 // Выход из кабинета 480 // Выход из кабинета
481 Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); 481 Route::get('logout', [EmployerController::class, 'logout'])->name('logout');
482 482
483 Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); 483 Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker');
484 Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); 484 Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer');
485 485
486 //восстановление пароля 486 //восстановление пароля
487 Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); 487 Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password');
488 // Звезда сообщения 488 // Звезда сообщения
489 Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer'); 489 Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer');
490 490
491 // Борьба 491 // Борьба
492 Route::get('clear_cookie', function() { 492 Route::get('clear_cookie', function() {
493 \App\Classes\Cookies_vacancy::clear_vacancy(); 493 \App\Classes\Cookies_vacancy::clear_vacancy();
494 return redirect()->route('index'); 494 return redirect()->route('index');
495 })->name('clear_cookie'); 495 })->name('clear_cookie');
496 496
497 Route::get('cookies', function() { 497 Route::get('cookies', function() {
498 return view('cookies'); 498 return view('cookies');
499 })->name('cookies'); 499 })->name('cookies');
500 500
501 // Личный кабинет работник 501 // Личный кабинет работник
502 Route::group([ 502 Route::group([
503 'as' => 'worker.', // имя маршрута, например auth.index 503 'as' => 'worker.', // имя маршрута, например auth.index
504 'prefix' => 'worker', // префикс маршрута, например auth/index 504 'prefix' => 'worker', // префикс маршрута, например auth/index
505 'middleware' => ['auth'], ['is_worker'], 505 'middleware' => ['auth', 'is_worker'],
506 ], function() { 506 ], function() {
507 // Формы редактирования 507 // Формы редактирования
508 Route::get('cabinet/basic_information', [WorkerController::class, 'basic_information'])->name('basic_information'); 508 Route::get('cabinet/basic_information', [WorkerController::class, 'basic_information'])->name('basic_information');
509 Route::get('cabinet/additional_documents', [WorkerController::class, 'additional_documents'])->name('additional_documents'); 509 Route::get('cabinet/additional_documents', [WorkerController::class, 'additional_documents'])->name('additional_documents');
510 510
511 // 1 страница - Моя анкета 511 // 1 страница - Моя анкета
512 Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet'); 512 Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet');
513 Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save'); 513 Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save');
514 Route::post('cabinet/cabinet_save_foto/{worker}', [WorkerController::class, 'cabinet_save_foto'])->name('cabinet_save_foto'); 514 Route::post('cabinet/cabinet_save_foto/{worker}', [WorkerController::class, 'cabinet_save_foto'])->name('cabinet_save_foto');
515 515
516 516
517 // 2 страница - Сообщения 517 // 2 страница - Сообщения
518 Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages'); 518 Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages');
519 Route::get('cabinet/dialog/{chat}', [WorkerController::class, 'dialog'])->name('dialog'); 519 Route::get('cabinet/dialog/{chat}', [WorkerController::class, 'dialog'])->name('dialog');
520 // 3 страница - Избранные вакансии 520 // 3 страница - Избранные вакансии
521 Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite'); 521 Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite');
522 // Продолжение борьбы против колорадов - избранные вакансии 522 // Продолжение борьбы против колорадов - избранные вакансии
523 Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado'); 523 Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado');
524 524
525 // 4 страница - Сменить пароль 525 // 4 страница - Сменить пароль
526 Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password'); 526 Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password');
527 Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password'); 527 Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password');
528 528
529 // 5 страница - Удалить профиль 529 // 5 страница - Удалить профиль
530 Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile'); 530 Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile');
531 Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result'); 531 Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result');
532 532
533 // Резюме -pdf 533 // Резюме -pdf
534 Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download'); 534 Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download');
535 535
536 // Поднятие анкеты 536 // Поднятие анкеты
537 Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up'); 537 Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up');
538 538
539 Route::post('test123', [WorkerController::class, 'test123'])->name('test123'); 539 Route::post('test123', [WorkerController::class, 'test123'])->name('test123');
540 540
541 // Добавление сертификата 541 // Добавление сертификата
542 Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate'); 542 Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate');
543 Route::post('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate'); 543 Route::post('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate');
544 Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate'); 544 Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate');
545 Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate'); 545 Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate');
546 Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate'); 546 Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate');
547 547
548 // Добавление предыдущих контактов компании 548 // Добавление предыдущих контактов компании
549 Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company'); 549 Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company');
550 Route::post('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company'); 550 Route::post('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company');
551 Route::get('кабинет/edit_prev_company/{doc}/{worker}', [WorkerController::class, 'edit_prev_company'])->name('edit_prev_company'); 551 Route::get('кабинет/edit_prev_company/{doc}/{worker}', [WorkerController::class, 'edit_prev_company'])->name('edit_prev_company');
552 Route::post('кабинет/update_prev_company/{doc}', [WorkerController::class, 'update_prev_company'])->name('update_prev_company'); 552 Route::post('кабинет/update_prev_company/{doc}', [WorkerController::class, 'update_prev_company'])->name('update_prev_company');
553 Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company'); 553 Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company');
554 554
555 // Добавление документа-диплома 555 // Добавление документа-диплома
556 Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom'); 556 Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom');
557 Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save'); 557 Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save');
558 Route::put('кабинет/edit_diploms/{worker}', [WorkerController::class, 'edit_diploms'])->name('edit_diploms'); 558 Route::put('кабинет/edit_diploms/{worker}', [WorkerController::class, 'edit_diploms'])->name('edit_diploms');
559 Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom'); 559 Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom');
560 560
561 // Добавление стандартного диплома 561 // Добавление стандартного диплома
562 Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document'); 562 Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document');
563 Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save'); 563 Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save');
564 Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document'); 564 Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document');
565 Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save'); 565 Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save');
566 Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document'); 566 Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document');
567 567
568 // Отправка сообщения работодателю от соискателя 568 // Отправка сообщения работодателю от соискателя
569 Route::post('сообщение/', [WorkerController::class, 'new_message'])->name('new_message'); 569 Route::post('сообщение/', [WorkerController::class, 'new_message'])->name('new_message');
570 }); 570 });
571 571
572 // Личный кабинет работодателя 572 // Личный кабинет работодателя
573 Route::group([ 573 Route::group([
574 'as' => 'employer.', // имя маршрута, например auth.index 574 'as' => 'employer.', // имя маршрута, например auth.index
575 'prefix' => 'employer', // префикс маршрута, например auth/index 575 'prefix' => 'employer', // префикс маршрута, например auth/index
576 'middleware' => ['auth'], !['is_worker'], 576 'middleware' => ['auth', 'is_employer'],
577 ], function() { 577 ], function() {
578 // 0 страница - Личные данные работодателя 578 // 0 страница - Личные данные работодателя
579 Route::get('cabinet/employer_info', [EmployerController::class, 'employer_info'])->name('employer_info'); 579 Route::get('cabinet/employer_info', [EmployerController::class, 'employer_info'])->name('employer_info');
580 Route::post('cabinet/employer_info/{user}', [EmployerController::class, 'employer_info_save'])->name('employer_info_save'); 580 Route::post('cabinet/employer_info/{user}', [EmployerController::class, 'employer_info_save'])->name('employer_info_save');
581 581
582 // 1 страница - Профиль 582 // 1 страница - Профиль
583 Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet'); 583 Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet');
584 Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save'); 584 Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save');
585 Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot'); 585 Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot');
586 Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot'); 586 Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot');
587 Route::get('cabinet/flot_edit/{Flot}/{Employer}', [EmployerController::class, 'edit_flot'])->name('edit_flot'); 587 Route::get('cabinet/flot_edit/{Flot}/{Employer}', [EmployerController::class, 'edit_flot'])->name('edit_flot');
588 Route::post('cabinet/flot_edit/{Flot}', [EmployerController::class, 'update_flot'])->name('update_flot_save'); 588 Route::post('cabinet/flot_edit/{Flot}', [EmployerController::class, 'update_flot'])->name('update_flot_save');
589 Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot'); 589 Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot');
590 590
591 // 2 страница - Добавление вакансий 591 // 2 страница - Добавление вакансий
592 Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie'); 592 Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie');
593 Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save'); 593 Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save');
594 //Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); 594 //Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people');
595 595
596 Route::get('cabinet/vacancie_danger', [EmployerController::class, 'cabinet_vacancie_danger'])->name('cabinet_vacancie_danger'); 596 Route::get('cabinet/vacancie_danger', [EmployerController::class, 'cabinet_vacancie_danger'])->name('cabinet_vacancie_danger');
597 597
598 598
599 599
600 Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); 600 Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people');
601 601
602 // 3 страница - Мои вакансии 602 // 3 страница - Мои вакансии
603 Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list'); 603 Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list');
604 Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); 604 Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit');
605 Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete'); 605 Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete');
606 Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up'); 606 Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up');
607 Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye'); 607 Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye');
608 Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); 608 Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit');
609 Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); 609 Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me');
610 610
611 // 4.1Ю. 611 // 4.1Ю.
612 Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac'); 612 Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac');
613 Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save'); 613 Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save');
614 Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac'); 614 Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac');
615 Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save'); 615 Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save');
616 Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac'); 616 Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac');
617 617
618 // 4 страница - Отклики на вакансии 618 // 4 страница - Отклики на вакансии
619 Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers'); 619 Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers');
620 Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple'); 620 Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple');
621 Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg'); 621 Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg');
622 622
623 // 5 страница - Сообщения 623 // 5 страница - Сообщения
624 Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages'); 624 Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages');
625 Route::get('cabinet/dialog/{chat}', [EmployerController::class, 'dialog'])->name('dialog'); 625 Route::get('cabinet/dialog/{chat}', [EmployerController::class, 'dialog'])->name('dialog');
626 Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message'); 626 Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message');
627 Route::post('test123', [EmployerController::class, 'test123'])->name('test123'); 627 Route::post('test123', [EmployerController::class, 'test123'])->name('test123');
628 628
629 // 6 страница - Избранный 629 // 6 страница - Избранный
630 Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites'); 630 Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites');
631 631
632 //7 страница - База данных 632 //7 страница - База данных
633 Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd'); 633 Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd');
634 634
635 //8 страница - База резюме 635 //8 страница - База резюме
636 Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe'); 636 Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe');
637 637
638 // 9 рассылка сообщений 638 // 9 рассылка сообщений
639 Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages'); 639 Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages');
640 Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post'); 640 Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post');
641 641
642 // 10 страница FAQ вопросы 642 // 10 страница FAQ вопросы
643 Route::get('cabinet/faq', [EmployerController::class, 'faq'])->name('faq'); 643 Route::get('cabinet/faq', [EmployerController::class, 'faq'])->name('faq');
644 644
645 // 11 страница - Настройка уведомлений 645 // 11 страница - Настройка уведомлений
646 Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe'); 646 Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe');
647 Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe'); 647 Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe');
648 648
649 // 12 страница - Сменить пароль 649 // 12 страница - Сменить пароль
650 Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset'); 650 Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset');
651 Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password'); 651 Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password');
652 652
653 // 13 страница - Удаление профиля 653 // 13 страница - Удаление профиля
654 Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people'); 654 Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people');
655 Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user'); 655 Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user');
656 Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user'); 656 Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user');
657 657
658 // Отправил сообщение 658 // Отправил сообщение
659 Route::post('сообщение/', [EmployerController::class, 'new_message'])->name('new_message'); 659 Route::post('сообщение/', [EmployerController::class, 'new_message'])->name('new_message');
660 660
661 Route::post('pin_chat/', [EmployerController::class, 'pin_chat'])->name('pin_chat'); 661 Route::post('pin_chat/', [EmployerController::class, 'pin_chat'])->name('pin_chat');
662 Route::post('remove_chat/', [EmployerController::class, 'remove_chat'])->name('remove_chat'); 662 Route::post('remove_chat/', [EmployerController::class, 'remove_chat'])->name('remove_chat');
663 }); 663 });
664 664
665 Route::get('TestWorker', [WorkerController::class, 'TestWorker'])->name('TestWorker'); 665 Route::get('TestWorker', [WorkerController::class, 'TestWorker'])->name('TestWorker');
666 666
667 Route::post('send_message', [HomeController::class, 'send_message'])->name('send_message'); 667 Route::post('send_message', [HomeController::class, 'send_message'])->name('send_message');
668 668
669 669