Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 public function boot()
 {
     // Bring in the routes
     require __DIR__ . '/../routes.php';
     // Add dirs
     View::addLocation(__DIR__ . '/../Views');
     Lang::addNamespace('pages', __DIR__ . '/../lang');
     Config::addNamespace('pages', __DIR__ . '/../config');
     // Observers
     Page::observe(new FileObserver());
     Page::observe(new HomePageObserver());
     Page::observe(new SortObserver());
     PageTranslation::observe(new UriObserver());
 }
Пример #3
0
 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\\Facades\\Facade');
     // Observers
     Page::observe(new FileObserver());
     Page::observe(new HomePageObserver());
     Page::observe(new SortObserver());
     Page::observe(new AddToMenuObserver());
     PageTranslation::observe(new UriObserver());
 }