/** * Bootstrap any application services. * * @return void */ public function boot() { view()->composer('layouts.master', function ($view) { $notification_obj = Notification::read(Auth::user()->id, true, 3); $notification_list = Notification::format($notification_obj); $view->with('user_notification_count', Notification::count(Auth::user()->id)); $view->with('user_notification_list', $notification_list); $view->with('user_messages_count', Messages::countUnseen()); $view->with('user_messages_list', Messages::topUnseen(3)); }); view()->composer('users.list', function ($view) { $view->with('company_id', User::where('id', Auth::user()->id)->with(['company' => function ($q) { $q->select('companies.id', 'companies.name'); }])->first()->company->pluck('id')->toArray()[0] ?? ""); $view->with('company_name', User::where('id', Auth::user()->id)->with(['company' => function ($q) { $q->select('companies.id', 'companies.name'); }])->first()->company->pluck('name')->toArray()[0] ?? ""); }); }