Blame view
app/Providers/MyServiceProvider.php
3.7 KB
5f2a2635a Справочник Должно... |
1 2 3 |
<?php namespace App\Providers; |
5b68533bb Работа над проект... |
4 |
use App\Models\Company; |
077a30c8a Таблица контента ... |
5 |
use App\Models\ContentRoles; |
e3c7b0ffb Коммит на понедел... |
6 |
use App\Models\Employer; |
5f2a2635a Справочник Должно... |
7 |
use App\Models\Job_title; |
e3c7b0ffb Коммит на понедел... |
8 |
use App\Models\Worker; |
f060aa75b Счетчик сообщений... |
9 10 |
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; |
5f2a2635a Справочник Должно... |
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 |
use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; class MyServiceProvider extends ServiceProvider { /** * Register services. * * @return void */ public function register() { // } /** * Bootstrap services. * * @return void */ public function boot() { $views = ['admin.job_titles.parent_id']; View::composer($views, function($view) { static $items = null; if (is_null($items)) { $items = Job_title::query()-> orderByDesc('sort')-> orderBy('name')-> active()-> get(); $parent = 0; $view->with(['items' => $items, 'parent' => $parent]); } else { $view->with(['items' => $items]); } } ); |
f060aa75b Счетчик сообщений... |
53 |
|
00652ea57 Оптимизация запро... |
54 |
$views2 = ['layout.admin', 'admin.index']; |
f060aa75b Счетчик сообщений... |
55 56 57 58 |
View::composer($views2, function($view){ $id = Auth::user()->id; |
077a30c8a Таблица контента ... |
59 60 61 62 |
$is_manager = Auth::user()->is_manager; $admin = Auth::user()->admin; $contents = ContentRoles::query()->get(); |
f060aa75b Счетчик сообщений... |
63 64 65 66 67 |
$query = DB::select(DB::raw('SELECT count(*) as MsgCount FROM messages m1 Where ((m1.flag_new = 1) and (m1.to_user_id = :uid)) '), ['uid' => $id] ); |
077a30c8a Таблица контента ... |
68 69 70 71 72 |
$view->with(['MsgCount' => $query[0]->MsgCount, 'UserId' => $id, 'is_manager' => $is_manager, 'admin' => $admin, 'contents' => $contents]); |
f060aa75b Счетчик сообщений... |
73 74 |
} ); |
5b68533bb Работа над проект... |
75 |
|
a9dfa8c95 Обновление на 7 м... |
76 |
$views3 = ['layout.frontend', 'index']; |
5b68533bb Работа над проект... |
77 78 79 80 81 |
View::composer($views3, function($view){ $id = Auth::user(); $companies = Company::query()->limit(1)->get(); |
a9dfa8c95 Обновление на 7 м... |
82 83 |
$jobs = Job_title::query()->get(); $view->with(['UserId' => $id, 'companies' => $companies, 'jobs' => $jobs]); |
5b68533bb Работа над проект... |
84 85 |
} ); |
e3c7b0ffb Коммит на понедел... |
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
$view1 = ['employers.menu', 'employers.emblema', 'employers.send_all']; View::composer($view1, function($view){ $user = Auth::user(); $id = $user->id; $employer = Employer::query()->where('user_id', $id)->get(); $id_employer = $employer[0]->id; $view->with(['id_employer' => $id_employer, 'Employer' => $employer]); } ); $view_worker = ['workers.emblema']; View::composer($view_worker, function($view_worker) { $user = Auth::user(); $id = $user->id; $Worker = Worker::query()->where('user_id', $id)->get(); $id_worker = $Worker[0]->id; $view_worker->with(['id_worker' => $id_worker, 'Worker' => $Worker, 'User' => $user]); } ); |
142d287bd Шаблоны кабинета ... |
108 109 110 111 112 113 114 115 |
$view_job_title = ['modals.register']; View::composer($view_job_title, function($view_job_title) { $Job_titles = Job_title::query()->get(); $view_job_title->with(['Job_titles' => $Job_titles]); } ); |
5f2a2635a Справочник Должно... |
116 117 |
} } |