public function viewArticle($slug)
 {
     $article = Article::findBySlugOrFail($slug);
     $article->category;
     $article->images;
     return view('vistas.article')->with('article', $article);
 }
 public function viewArticle($slug)
 {
     $article = Article::findBySlugOrFail($slug);
     $article->category;
     $article->user;
     $article->tags;
     $article->images;
     return view('front.article')->with('article', $article);
 }
Exemplo n.º 3
0
 public function contentArticle($slug)
 {
     $article = Article::findBySlugOrFail($slug);
     $article->category;
     $article->user;
     $article->tags;
     $article->images;
     return view('front.content', compact('article'));
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @return void
  */
 public function boot()
 {
     parent::boot();
     Route::model('article', Article::class);
     Route::bind('article_slug', function ($slug) {
         return Article::findBySlugOrFail($slug);
     });
     Route::model('category', Category::class);
     Route::bind('category_slug', function ($slug) {
         return Category::findBySlugOrFail($slug);
     });
     Route::model('language', Language::class);
     Route::model('page', Page::class);
     Route::bind('page_slug', function ($slug) {
         return Page::findBySlugOrFail($slug);
     });
     Route::model('setting', Setting::class);
     Route::model('user', User::class);
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->model('article', 'App\\Article');
     $router->bind('article_slug', function ($slug) {
         return Article::findBySlugOrFail($slug);
     });
     $router->model('category', 'App\\Category');
     $router->bind('category_slug', function ($slug) {
         return Category::findBySlugOrFail($slug);
     });
     $router->model('language', 'App\\Language');
     $router->model('page', 'App\\Page');
     $router->bind('page_slug', function ($slug) {
         return Page::findBySlugOrFail($slug);
     });
     $router->model('setting', 'App\\Setting');
     $router->model('user', 'App\\User');
 }
 /**
  * Show the article.
  *
  * @param String $slug
  * @return Response
  */
 public function index(string $slug)
 {
     $article = Article::findBySlugOrFail($slug);
     Event::fire(new ArticleWasViewed($article));
     return view('application.article.index', compact('article'));
 }