Commit 73b12960f4266aff6e366cc88c1c9a4d79080c6e
1 parent
85dc0eb944
Exists in
master
and in
1 other branch
Коммит по обновлению должностей - 4 обновление
Showing 1 changed file with 2 additions and 1 deletions Inline Diff
app/Providers/MyServiceProvider.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Providers; | 3 | namespace App\Providers; |
4 | 4 | ||
5 | use App\Models\Company; | 5 | use App\Models\Company; |
6 | use App\Models\ContentRoles; | 6 | use App\Models\ContentRoles; |
7 | use App\Models\Employer; | 7 | use App\Models\Employer; |
8 | use App\Models\Job_title; | 8 | use App\Models\Job_title; |
9 | use App\Models\Worker; | 9 | use App\Models\Worker; |
10 | use Illuminate\Support\Facades\Auth; | 10 | use Illuminate\Support\Facades\Auth; |
11 | use Illuminate\Support\Facades\DB; | 11 | use Illuminate\Support\Facades\DB; |
12 | use Illuminate\Support\Facades\View; | 12 | use Illuminate\Support\Facades\View; |
13 | use Illuminate\Support\ServiceProvider; | 13 | use Illuminate\Support\ServiceProvider; |
14 | 14 | ||
15 | class MyServiceProvider extends ServiceProvider | 15 | class MyServiceProvider extends ServiceProvider |
16 | { | 16 | { |
17 | /** | 17 | /** |
18 | * Register services. | 18 | * Register services. |
19 | * | 19 | * |
20 | * @return void | 20 | * @return void |
21 | */ | 21 | */ |
22 | public function register() | 22 | public function register() |
23 | { | 23 | { |
24 | // | 24 | // |
25 | } | 25 | } |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Bootstrap services. | 28 | * Bootstrap services. |
29 | * | 29 | * |
30 | * @return void | 30 | * @return void |
31 | */ | 31 | */ |
32 | public function boot() | 32 | public function boot() |
33 | { | 33 | { |
34 | $views = ['admin.job_titles.parent_id']; | 34 | $views = ['admin.job_titles.parent_id']; |
35 | View::composer($views, | 35 | View::composer($views, |
36 | function($view) | 36 | function($view) |
37 | { | 37 | { |
38 | static $items = null; | 38 | static $items = null; |
39 | 39 | ||
40 | if (is_null($items)) { | 40 | if (is_null($items)) { |
41 | $items = Job_title::query()-> | 41 | $items = Job_title::query()-> |
42 | orderByDesc('sort')-> | 42 | orderByDesc('sort')-> |
43 | orderBy('name')-> | 43 | orderBy('name')-> |
44 | active()-> | 44 | active()-> |
45 | get(); | 45 | get(); |
46 | $parent = 0; | 46 | $parent = 0; |
47 | $view->with(['items' => $items, 'parent' => $parent]); | 47 | $view->with(['items' => $items, 'parent' => $parent]); |
48 | } else { | 48 | } else { |
49 | $view->with(['items' => $items]); | 49 | $view->with(['items' => $items]); |
50 | } | 50 | } |
51 | 51 | ||
52 | } | 52 | } |
53 | ); | 53 | ); |
54 | 54 | ||
55 | $views2 = ['layout.admin', 'admin.index']; | 55 | $views2 = ['layout.admin', 'admin.index']; |
56 | 56 | ||
57 | View::composer($views2, | 57 | View::composer($views2, |
58 | function($view){ | 58 | function($view){ |
59 | $id = Auth::user()->id; | 59 | $id = Auth::user()->id; |
60 | $is_manager = Auth::user()->is_manager; | 60 | $is_manager = Auth::user()->is_manager; |
61 | $admin = Auth::user()->admin; | 61 | $admin = Auth::user()->admin; |
62 | 62 | ||
63 | $contents = ContentRoles::query()->get(); | 63 | $contents = ContentRoles::query()->get(); |
64 | 64 | ||
65 | $query = DB::select(DB::raw('SELECT count(*) as MsgCount | 65 | $query = DB::select(DB::raw('SELECT count(*) as MsgCount |
66 | FROM messages m1 | 66 | FROM messages m1 |
67 | Where ((m1.flag_new = 1) and (m1.to_user_id = :uid)) | 67 | Where ((m1.flag_new = 1) and (m1.to_user_id = :uid)) |
68 | '), ['uid' => $id] | 68 | '), ['uid' => $id] |
69 | ); | 69 | ); |
70 | 70 | ||
71 | $view->with(['MsgCount' => $query[0]->MsgCount, | 71 | $view->with(['MsgCount' => $query[0]->MsgCount, |
72 | 'UserId' => $id, | 72 | 'UserId' => $id, |
73 | 'is_manager' => $is_manager, | 73 | 'is_manager' => $is_manager, |
74 | 'admin' => $admin, | 74 | 'admin' => $admin, |
75 | 'contents' => $contents]); | 75 | 'contents' => $contents]); |
76 | } | 76 | } |
77 | ); | 77 | ); |
78 | 78 | ||
79 | $views3 = ['layout.frontend', 'index']; | 79 | $views3 = ['layout.frontend', 'index']; |
80 | 80 | ||
81 | View::composer($views3, | 81 | View::composer($views3, |
82 | function($view){ | 82 | function($view){ |
83 | $id = Auth::user(); | 83 | $id = Auth::user(); |
84 | $companies = Company::query()->limit(1)->get(); | 84 | $companies = Company::query()->limit(1)->get(); |
85 | $jobs = Job_title::query()->where('is_remove', '=', '0')->get(); | 85 | $jobs = Job_title::query()->where('is_remove', '=', '0')->get(); |
86 | $view->with(['UserId' => $id, 'companies' => $companies, 'jobs' => $jobs]); | 86 | $view->with(['UserId' => $id, 'companies' => $companies, 'jobs' => $jobs]); |
87 | } | 87 | } |
88 | ); | 88 | ); |
89 | 89 | ||
90 | $view1 = ['employers.menu', 'employers.emblema', 'employers.send_all']; | 90 | $view1 = ['employers.menu', 'employers.emblema', 'employers.send_all']; |
91 | View::composer($view1, | 91 | View::composer($view1, |
92 | function($view){ | 92 | function($view){ |
93 | $user = Auth::user(); | 93 | $user = Auth::user(); |
94 | $id = $user->id; | 94 | $id = $user->id; |
95 | $employer = Employer::query()->where('user_id', $id)->get(); | 95 | $employer = Employer::query()->where('user_id', $id)->get(); |
96 | $id_employer = $employer[0]->id; | 96 | $id_employer = $employer[0]->id; |
97 | $view->with(['id_employer' => $id_employer, 'Employer' => $employer]); | 97 | $view->with(['id_employer' => $id_employer, 'Employer' => $employer]); |
98 | } | 98 | } |
99 | ); | 99 | ); |
100 | 100 | ||
101 | $view_worker = ['workers.emblema']; | 101 | $view_worker = ['workers.emblema']; |
102 | View::composer($view_worker, | 102 | View::composer($view_worker, |
103 | function($view_worker) { | 103 | function($view_worker) { |
104 | $user = Auth::user(); | 104 | $user = Auth::user(); |
105 | $id = $user->id; | 105 | $id = $user->id; |
106 | $Worker = Worker::query()->where('user_id', $id)->get(); | 106 | $Worker = Worker::query()->where('user_id', $id)->get(); |
107 | $id_worker = $Worker[0]->id; | 107 | $id_worker = $Worker[0]->id; |
108 | $view_worker->with(['id_worker' => $id_worker, 'Worker' => $Worker, 'User' => $user]); | 108 | $view_worker->with(['id_worker' => $id_worker, 'Worker' => $Worker, 'User' => $user]); |
109 | } | 109 | } |
110 | ); | 110 | ); |
111 | 111 | ||
112 | $view_job_title = ['modals.register']; | 112 | $view_job_title = ['modals.register']; |
113 | View::composer($view_job_title, | 113 | View::composer($view_job_title, |
114 | function($view_job_title) { | 114 | function($view_job_title) { |
115 | $Job_titles = Job_title::query()->where('is_remove', '=', '1')->where('is_bd', '=' , '0')->get(); | 115 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> |
116 | where('is_bd', '=' , '1')->get(); | ||
116 | $view_job_title->with(['Job_titles' => $Job_titles]); | 117 | $view_job_title->with(['Job_titles' => $Job_titles]); |
117 | } | 118 | } |
118 | ); | 119 | ); |
119 | 120 | ||
120 | } | 121 | } |
121 | } | 122 | } |
122 | 123 |