Пример #1
0
 public function boot()
 {
     // Bring in the routes
     require __DIR__ . '/../routes.php';
     // Add dirs
     View::addLocation(__DIR__ . '/../Views');
     Lang::addNamespace('categories', __DIR__ . '/../lang');
     Config::addNamespace('categories', __DIR__ . '/../config');
     // Observers
     CategoryTranslation::observe(new SlugObserver());
     Category::observe(new FileObserver());
 }
 /**
  * Show resource.
  *
  * @return \Illuminate\Support\Facades\Response
  */
 public function show($category = null, $slug = null)
 {
     $model = $this->repository->bySlug($slug);
     if (is_string($category)) {
         $category = CategoryTranslation::where('slug', $category)->first();
         if (!$category || $category->category_id != $model->category_id) {
             abort(404);
         }
     } elseif ($category->id != $model->category_id) {
         abort(404);
     }
     return view('projects::public.show')->with(compact('model'));
 }
Пример #3
0
 public function boot()
 {
     $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'typicms.categories');
     $modules = $this->app['config']['typicms']['modules'];
     $this->app['config']->set('typicms.modules', array_merge(['categories' => []], $modules));
     $this->loadViewsFrom(__DIR__ . '/../resources/views/', 'categories');
     $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'categories');
     $this->publishes([__DIR__ . '/../resources/views' => base_path('resources/views/vendor/categories')], 'views');
     $this->publishes([__DIR__ . '/../database' => base_path('database')], 'migrations');
     AliasLoader::getInstance()->alias('Categories', 'TypiCMS\\Modules\\Categories\\Facades\\Facade');
     // Observers
     CategoryTranslation::observe(new SlugObserver());
     Category::observe(new FileObserver());
 }