/** * Check if uri exists. * * @param PageTranslation $model * @param string $uri * @param int $id * * @return bool */ private function uriExists(PageTranslation $model, $uri, $id) { $query = $model->where('uri', $uri)->where('locale', $model->locale); if ($id) { $query->where('id', '!=', $id); } if ($query->first()) { return true; } return false; }
public function boot() { $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'typicms.pages'); $modules = $this->app['config']['typicms']['modules']; $this->app['config']->set('typicms.modules', array_merge(['pages' => []], $modules)); $this->loadViewsFrom(__DIR__ . '/../resources/views/', 'pages'); $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'pages'); $this->publishes([__DIR__ . '/../resources/views' => base_path('resources/views/vendor/pages')], 'views'); $this->publishes([__DIR__ . '/../database' => base_path('database')], 'migrations'); AliasLoader::getInstance()->alias('Pages', 'TypiCMS\\Modules\\Pages\\Shells\\Facades\\Facade'); // Observers Page::observe(new FileObserver()); Page::observe(new HomePageObserver()); Page::observe(new SortObserver()); Page::observe(new AddToMenuObserver()); PageTranslation::observe(new UriObserver()); }