※有料会員になるとこの動画をご利用いただけます
詳しい説明を読む
#08:新規投稿フォームを作成しよう
ここでは、1行掲示板の新規投稿フォームを作成します。前回のレッスンで、新規投稿を格納するcreateメソッドを作成してあるので、それに投稿フォームを組み合わせます。
app/Http/Controllers/ArticleController.php
public function store(Request $request)
{
$article = new Article;
$article->content = 'Hello BBS';
$article->user_name = 'paiza';
$article->save();
return redirect('/articles');
}
app/Http/Controllers/ArticleController.php
public function create(Request $request)
{
$message = 'New article';
return view('new', ['message' => $message]);
}
Laravel Recipes日本語版 | Formファサードのレシピ
http://recipes.laravel.jp/category/17
Laravel Recipes日本語版 | モデルをベースにしたフォームを作成する
http://recipes.laravel.jp/recipe/221
Laravel Collective
https://github.com/LaravelCollective/docs/blob/master/html.md
ファサード 5.7 Laravel
https://readouble.com/laravel/5.7/ja/facades.html
Bladeテンプレート 5.7 Laravel
https://readouble.com/laravel/5.7/ja/blade.html