protected function setRouterBind() { $this->app->router->bind('articles', function ($id) { $article = Article::find($id); if (!$article) { abort(404); } return $article; }); }
public function restore($id) { $article = Article::onlyTrashed()->find($id); if (!$article) { abort(404); } if ($article->restore()) { Flash::success('Item restaurado com sucesso.'); } else { Flash::error('Falha na restauração.'); } return ($url = session()->get('backUrl')) ? redirect($url) : redirect()->route('admin.articles.trash'); }
public function show($slug) { return Article::select($this->fields)->with(['seo', 'galleries.images'])->active()->where('slug', $slug)->first(); }