/**
  * Compose the view before rendering.
  *
  * @param  View $view
  * @return View
  */
 public function compose(View $view)
 {
     if (!$this->theme || !env('INSTALLED')) {
         $this->events->fire(new ViewComposed($view));
         return $view;
     }
     $mobile = $this->mobiles->get($this->theme->getNamespace(), []);
     $overrides = $this->overrides->get($this->theme->getNamespace(), []);
     if ($this->mobile && ($path = array_get($mobile, $view->getName(), null))) {
         $view->setPath($path);
     } elseif ($path = array_get($overrides, $view->getName(), null)) {
         $view->setPath($path);
     }
     if ($this->module) {
         $mobile = $this->mobiles->get($this->module->getNamespace(), []);
         $overrides = $this->overrides->get($this->module->getNamespace(), []);
         if ($this->mobile && ($path = array_get($mobile, $view->getName(), null))) {
             $view->setPath($path);
         } elseif ($path = array_get($overrides, $view->getName(), null)) {
             $view->setPath($path);
         }
     }
     if ($overload = $this->getOverloadPath($view)) {
         $view->setPath($overload);
     }
     $this->events->fire(new ViewComposed($view));
     return $view;
 }
 /**
  * Register view overrides.
  *
  * @param AddonServiceProvider $provider
  * @param Addon $addon
  */
 protected function registerOverrides(AddonServiceProvider $provider, Addon $addon)
 {
     $overrides = $provider->getOverrides();
     $mobiles = $provider->getMobile();
     if (!$overrides && !$mobiles) {
         return;
     }
     $this->viewOverrides->put($addon->getNamespace(), $overrides);
     $this->viewMobileOverrides->put($addon->getNamespace(), $mobiles);
 }