質問編集履歴
3
ご指摘を受けましてマークダウン記法に書き換えました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
### 該当のソースコード
|
14
14
|
|
15
15
|
以下、➀createのhtml、➁showのhtml、➂create,showのコントローラーのソースコードです。
|
16
|
+
```laravel
|
16
17
|
create.blade.php----------------------------------------------------------➀
|
17
18
|
@extends("layouts.layouts")
|
18
19
|
|
@@ -132,6 +133,7 @@
|
|
132
133
|
|
133
134
|
return redirect()->route('books.show', $book);
|
134
135
|
}
|
136
|
+
```
|
135
137
|
### 試したこと
|
136
138
|
|
137
139
|
419
|
2
ご指摘を受けましてマークダウン記法に書き換えました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
@extends("layouts.layouts")
|
18
18
|
|
19
19
|
@section("content")
|
20
|
-
<h1>新しい家計簿データを追加</h1>
|
20
|
+
###<h1>新しい家計簿データを追加</h1>
|
21
21
|
|
22
22
|
<form method="POST" action="/books">
|
23
23
|
@csrf
|
@@ -60,7 +60,7 @@
|
|
60
60
|
<label for="product-name">金額</label>
|
61
61
|
<input type="number" name="amount" id="product-name" class="form-control">
|
62
62
|
</div>
|
63
|
-
|
63
|
+
###送信ボタン
|
64
64
|
<button type="submit" class="btn btn-primary">送信</button>
|
65
65
|
<a href="{{route('books.index')}}" class="btn btn-secondary">戻る</a>
|
66
66
|
</form>
|
@@ -71,7 +71,7 @@
|
|
71
71
|
|
72
72
|
@section("content")
|
73
73
|
|
74
|
-
<h1>家計簿詳細</h1>
|
74
|
+
##<h1>家計簿詳細</h1>
|
75
75
|
<table class="table table-striped">
|
76
76
|
@csrf
|
77
77
|
<tr>
|
@@ -92,7 +92,7 @@
|
|
92
92
|
<td>{{$book->amount}}万円</td>
|
93
93
|
</tr>
|
94
94
|
</table>
|
95
|
-
|
95
|
+
####戻るボタン
|
96
96
|
<a href="{{route('books.index')}}" class="btn btn-secondary">戻る</a>
|
97
97
|
@endsection
|
98
98
|
|
@@ -107,9 +107,9 @@
|
|
107
107
|
class BookController extends Controller
|
108
108
|
{
|
109
109
|
function index(){
|
110
|
-
bookテーブルに入っているデータをすべて取ってくる
|
110
|
+
##bookテーブルに入っているデータをすべて取ってくる
|
111
111
|
$books = Book::all();
|
112
|
-
使うビューファイルを指定
|
112
|
+
##使うビューファイルを指定
|
113
113
|
compactにはビューファイルに送るデータを選択
|
114
114
|
return view("books.index",compact("books"));
|
115
115
|
}
|
@@ -119,7 +119,7 @@
|
|
119
119
|
public function create(){
|
120
120
|
return view("books.create");
|
121
121
|
}
|
122
|
-
|
122
|
+
###新規登録機能(コントローラー)
|
123
123
|
public function store(Request $request){
|
124
124
|
|
125
125
|
$book = new Book();
|
1
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -107,10 +107,10 @@
|
|
107
107
|
class BookController extends Controller
|
108
108
|
{
|
109
109
|
function index(){
|
110
|
-
|
110
|
+
bookテーブルに入っているデータをすべて取ってくる
|
111
111
|
$books = Book::all();
|
112
|
-
|
112
|
+
使うビューファイルを指定
|
113
|
-
|
113
|
+
compactにはビューファイルに送るデータを選択
|
114
114
|
return view("books.index",compact("books"));
|
115
115
|
}
|
116
116
|
function show(Book $book){
|