Пример #1
0
 /**
  * Generic configuration for tenant.
  *
  * @return array
  * @throws TenantDatabaseException
  * @throws \Laracasts\Presenter\Exceptions\PresenterException
  */
 protected function config()
 {
     $clone = Config::get(sprintf('database.connections.%s', static::systemConnectionName()));
     if (Config::get('multi-tenant.db.tenant-division-mode') == static::TENANT_MODE_SEPARATE_DATABASE) {
         $clone['password'] = md5(Config::get('app.key') . $this->website->id);
         $clone['username'] = $clone['database'] = sprintf('%d-%s', $this->website->id, $this->website->present()->identifier);
     } elseif (Config::get('multi-tenant.db.tenant-division-mode') == static::TENANT_MODE_TABLE_PREFIX) {
         $clone['prefix'] = sprintf('t%d_', $this->website->id);
     } else {
         throw new TenantDatabaseException('Unknown database division mode configured in the multi-tenant configuration file.');
     }
     return $clone;
 }
 /**
  * Shows the delete website form.
  *
  * @param Website $website
  * @return \Illuminate\View\View
  */
 public function delete(Website $website)
 {
     $deleteRoute = route('management-interface.website.deleted', $website->present()->urlArguments);
     $name = $website->present()->name;
     return view('management-interface::layouts.delete', compact('website', 'deleteRoute', 'name'));
 }
 /**
  * @param HostnameRepositoryContract $hostname
  * @param Website                    $website
  * @param $name
  *
  * @throws \Laracasts\Presenter\Exceptions\PresenterException
  *
  * @return $this|bool|\Hyn\Framework\Models\AbstractModel|null
  */
 public function added(HostnameRepositoryContract $hostname, Website $website, $name)
 {
     return (new HostnameValidator())->catchFormRequest($hostname->newInstance(), redirect()->route('management-interface.website.read', $website->present()->urlArguments));
 }