/**
  * Registers view bindings
  *
  * @param NodeRepository $nodeRepository
  */
 protected function registerViewBindings(NodeRepository $nodeRepository)
 {
     if (!is_installed()) {
         return;
     }
     if (!is_request_reactor()) {
         $home = $nodeRepository->getHome(false);
         view()->share('home', $home);
     }
     view()->composer('*', function ($view) {
         $view->with('currentUser', auth()->user());
     });
     if (is_request_reactor()) {
         view()->composer('partials.navigation.nodes', function ($view) {
             $leafs = empty($id = auth()->user()->home) ? Node::whereIsRoot()->defaultOrder()->get() : [Node::find($id)];
             $view->with('leafs', $leafs);
         });
     }
 }
Beispiel #2
0
 /**
  * Shows the homepage
  *
  * @param NodeRepository $nodeRepository
  * @return View
  */
 public function getHome(NodeRepository $nodeRepository)
 {
     $home = $nodeRepository->getHome();
     return view('index', compact('home'));
 }