teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

Route::get → post

2020/07/06 06:16

投稿

pup-ganbaru
pup-ganbaru

スコア29

title CHANGED
File without changes
body CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  web.php
19
19
  ```
20
- Route::get('title/add,', 'TitleController@store');
20
+ Route::post('title/add,', 'TitleController@store');
21
21
  ```
22
22
  add.blade.php
23
23
  ```

3

タイトルに追記

2020/07/06 06:16

投稿

pup-ganbaru
pup-ganbaru

スコア29

title CHANGED
File without changes
body CHANGED
@@ -4,7 +4,8 @@
4
4
  actresses テーブルに追加しようとしています。
5
5
  よろしくお願い致します
6
6
 
7
- ```TitleController.php
7
+ TitleController.php
8
+ ```
8
9
  public function store(Request $Request)
9
10
  {
10
11
  $actress = new Actress;
@@ -14,11 +15,12 @@
14
15
  }
15
16
  ```
16
17
 
17
- ```web.php
18
+ web.php
19
+ ```
18
20
  Route::get('title/add,', 'TitleController@store');
19
21
  ```
20
-
21
- ```add.blade.php
22
+ add.blade.php
23
+ ```
22
24
  <h2>リスト追加</h2>
23
25
  <form method="post">
24
26
  {{csrf_field() }}
@@ -27,8 +29,8 @@
27
29
  <input type="submit" name="submit" value="送信">
28
30
  </form>
29
31
  ```
30
-
31
- ```Actress.php
32
+ Actress.php
33
+ ```
32
34
  <?php
33
35
 
34
36
  namespace App;

2

タイトルに追記

2020/07/06 06:10

投稿

pup-ganbaru
pup-ganbaru

スコア29

title CHANGED
File without changes
body CHANGED
@@ -26,4 +26,18 @@
26
26
  <label>女優: <input id="name" type="text" name="actress" value=""></label>
27
27
  <input type="submit" name="submit" value="送信">
28
28
  </form>
29
+ ```
30
+
31
+ ```Actress.php
32
+ <?php
33
+
34
+ namespace App;
35
+
36
+ use Illuminate\Database\Eloquent\Model;
37
+
38
+ class Actress extends Model
39
+ {
40
+ protected $table ='actresses';
41
+ protected $guarded = array('id');
42
+ }
29
43
  ```

1

タイトルに追記

2020/07/06 06:08

投稿

pup-ganbaru
pup-ganbaru

スコア29

title CHANGED
@@ -1,1 +1,1 @@
1
- データベースにフォームからデータを追加できない
1
+ 【Laravel】【MySQL】データベースにフォームからデータを追加できない
body CHANGED
File without changes