Exemplo n.º 1
0
 /**
  * Loads Hostname models based on request.
  *
  * @param HostnameRepositoryContract $hostname
  *
  * @return \Hyn\MultiTenant\Models\Hostname
  */
 public static function hostname(HostnameRepositoryContract $hostname)
 {
     $tenant_hostname = null;
     try {
         if (!App::runningInConsole()) {
             $tenant_hostname = $hostname->findByHostname(Request::getHttpHost());
         }
         if (!$tenant_hostname) {
             $tenant_hostname = $hostname->getDefault();
         }
     } catch (QueryException $e) {
         // table not found, set up not yet done
         if (preg_match('/\\Qtable or view not found\\E/', $e->getMessage())) {
             return;
         }
     }
     return $tenant_hostname;
 }
Exemplo n.º 2
0
 /**
  * Return default website.
  *
  * @return \Hyn\MultiTenant\Models\Website
  */
 public function getDefault()
 {
     return $this->hostname->getDefault()->website;
 }