WorkerController.php
3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
namespace App\Http\Controllers;
use App\Models\Message;
use App\Models\Static_worker;
use App\Models\Worker;
use Illuminate\Http\Request;
class WorkerController extends Controller
{
public $status_work = Array(0 => 'Ищу работу', 1=> 'Не указано', 2=>'Не ищу работу');
//профиль
public function profile(Worker $worker) {
$get_date = date('Y.m');
$c = Static_worker::query()->where('year_month', '=', $get_date)
->where('user_id', '=', $worker->users->id)
->get();
if ($c->count() > 0) {
$upd = Static_worker::find($c[0]->id);
$upd->lookin = $upd->lookin + 1;
$upd->save();
} else {
$crt = new Static_worker();
$crt->lookin = 1;
$crt->year_month = $get_date;
$crt->user_id = $worker->user_id;
$crt->save();
}
$stat = Static_worker::query()->where('year_month', '=', $get_date)
->where('user_id', '=', $worker->users->id)
->get();
return view('public.workers.profile', compact('worker', 'stat'));
}
// лист база резюме
public function bd_resume() {
$status_work = $this->status_work;
$resumes = Worker::query()->with('users')->with('job_titles');
$res_count = $resumes->count();
$resumes = $resumes->paginate(5);
return view('resume', compact('resumes', 'status_work', 'res_count'));
}
// анкета соискателя
public function resume_profile(Worker $worker) {
$status_work = $this->status_work;
$Query = Worker::query()->with('users')->with('job_titles')
->with('place_worker')->with('sertificate')->with('prev_company')
->with('infobloks');
$Query = $Query->where('id', '=', $worker->id);
$Query = $Query->get();
return view('worker', compact('Query', 'status_work'));
}
// скачать анкету соискателя
public function resume_download(Worker $worker) {
print_r('Резюме для скачивания');
}
// Кабинет работника
public function cabinet(Worker $worker) {
return view('workers.cabinet', compact('worker'));
}
// Сохранение данных
public function cabinet_save(Worker $worker, Request $request) {
}
// Сообщения данные
public function messages($type_message) {
$user_id = Auth()->user()->id;
$messages_input = Message::query()->with('vacancies')->with('user_from')->
Where('to_user_id', $user_id)->OrderByDesc('created_at');
$messages_output = Message::query()->with('vacancies')->
with('user_to')->where('user_id', $user_id)->
OrderByDesc('created_at');
$count_input = $messages_input->count();
$count_output = $messages_output->count();
if ($type_message == 'input') {
$messages = $messages_input->paginate(15);
}
if ($type_message == 'output') {
$messages = $messages_output->paginate(15);
}
// Вернуть все 100%
return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id'));
}
// Избранный
public function favorite() {
return view('workers.favorite');
}
// Сменить пароль
public function new_password() {
return view('workers.new_password');
}
// Удаление профиля
public function delete_profile() {
return view('workers.delete_profile');
}
}