public function boot() { // configuration $this->mergeConfigFrom(__DIR__ . '/../config/webserver.php', 'webserver'); $this->publishes([__DIR__ . '/../config/webserver.php' => config_path('webserver.php')], 'webserver-config'); // adds views $this->loadViewsFrom(__DIR__ . '/../views', 'webserver'); // migrations $this->publishes([__DIR__ . '/../database/migrations/' => database_path('/migrations')], 'migrations'); Website::observe(new Observers\WebsiteObserver()); SslCertificate::observe(new Observers\SslCertificateObserver()); Hostname::observe(new Observers\HostnameObserver()); /* * Ssl repository */ $this->app->bind('Hyn\\Webserver\\Contracts\\SslRepositoryContract', function ($app) { return new SslRepository(new SslCertificate(), new SslHostname()); }); /* * Toolbox command */ $this->app->bind('hyn.webserver.command.toolbox', function ($app) { return new Commands\ToolboxCommand($app->make(WebsiteRepositoryContract::class)); }); $this->commands(['hyn.webserver.command.toolbox']); }
/** * Create a pagination object. * * @param int $per_page * * @return mixed */ public function paginated($per_page = 20) { return $this->hostname->paginate($per_page); }
/** * Shows the delete hostname form. * * @param Hostname $hostname * @return \Illuminate\View\View * @throws \Laracasts\Presenter\Exceptions\PresenterException */ public function delete(Hostname $hostname) { $deleteRoute = route('management-interface.hostname.deleted', $hostname->present()->urlArguments); $name = $hostname->present()->name; return view('management-interface::layouts.delete', compact('hostname', 'deleteRoute', 'name')); }
/** * Registers model observers. */ protected function observers() { Models\Website::observe(new Observers\WebsiteObserver()); Models\Hostname::observe(new Observers\HostnameObserver()); Models\Tenant::observe(new Observers\TenantObserver()); }