示例#1
0
 /**
  * Create a new article in edit mode to be included in the editing iframe.
  * 編集フレームの中に入れるのために、編集モードで新い記事を受くる。
  *
  * @param string $type The type of article to create
  * @return Response New article content in edit mode.
  */
 public function newIframeContent($type)
 {
     $article = new Article(['type' => $type, 'fields' => []]);
     $theme = \ThemeLoader::load();
     $rendered_article = \ArticleRenderer::render($article, $theme);
     return response($rendered_article, 200);
 }
示例#2
0
 /**
  * Display the specified resource.
  *
  * @param  string $slug The slug identifier for the article
  * 
  * @return \Illuminate\Http\Response
  */
 public function show($slug)
 {
     try {
         $article = \ArticleRepository::load($slug);
         $theme = \ThemeLoader::load();
         $rendered_article = \ArticleRenderer::render($article, $theme);
         return response($rendered_article, 200);
     } catch (ArticleNotFoundException $e) {
         return response("article not found", 404);
     }
 }