/** * 公開済みのブログの記事を追加 * * @return DOMDocument */ public function addArticle() { $articles = Article::where('state', 'public')->get(); foreach ($articles as $article) { $this->add($article); } return $this->dom; }
/** * 公開済みのブログの記事を追加 * * @return DOMDocument */ public function addArticle() { $articles = Article::where('state', 'public')->get(); foreach ($articles as $article) { $this->add(route('blog.show', $article->slug)); } return $this->dom; }
/** * 個別記事の表示 * * @param string $slug * * @return Response */ public function getSingle($slug) { $article = Article::where('slug', $slug)->with('tags', 'icon')->first(); if (!$article) { return abort(404); } $client = new GoogleDrive($article->text); $created_at = new \DateTime($article->created_at); $updated_at = $client->getModifiedDate($created_at); $parser = new MyMarkdown(); $parser->html5 = true; $html_content = $parser->parse($client->getContent()); $html_menu = $parser->createMenu(route('blog.show', $slug)); return view('contents.blog.single')->with('article', $article)->with('created_at', $created_at)->with('updated_at', $updated_at)->with('title', $article->title)->with('html_menu', $html_menu)->with('html_content', $html_content); }