/** * 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); }
/** * Return an image stored in the current theme. * * @param string $image_name The name of the image to be loaded * * @return Response a 200 with the image data if found, or a 404 if not found */ public function getThemeImage($image_name) { try { $theme = \ThemeLoader::load(); $image_location = $theme->imageLocation($image_name); $image = \ImageLoader::load($image_location); return response($image->data(), 200); } catch (ImageNotFoundException $e) { return response("image not found", 404); } }
/** * 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); } }