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

質問編集履歴

4

修正

2019/06/27 06:16

投稿

toll_tree
toll_tree

スコア199

title CHANGED
File without changes
body CHANGED
@@ -20,7 +20,7 @@
20
20
  <body>
21
21
  <form method="post" action="/index" >
22
22
  <input type="submit" value='送信'>
23
-    <input type="hidden" name="data"value="{{$date}}"
23
+    <input type="hidden" name="data"value="{{$date}}">
24
24
 
25
25
  </form>
26
26
  </body>

3

修正

2019/06/27 06:16

投稿

toll_tree
toll_tree

スコア199

title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,5 @@
1
1
  post、またはgetにより、変数データ(オブジェクト)をコントローラー部分へ送る方法はありますでしょうか?
2
- 具体的には下記コードTestController.phpの「test」メソッド内にて、index.blade.phpへ送った$dateメソッドを、index.blade.phpのフォーム内にて組み込み、TestControllerの「index」メソッド内にて、ルーティングを通し渡したいです。
2
+ 具体的には下記コードTestController.phpの「test」メソッド内にて、index.blade.phpへ送った$dateを、index.blade.phpのフォーム内にて組み込み、TestControllerの「index」メソッド内にて、ルーティングを通し渡したいです。
3
3
  以下は、TestController.phpです。
4
4
  ※ミニマムコードとして、作成しましたので多少省かせてもらっています。
5
5
  ```
@@ -9,8 +9,8 @@
9
9
  $date = new Carbon();
10
10
  return view('index',['date' => $date]);
11
11
  }
12
- public function index(){
12
+ public function index(Request $request){
13
-
13
+ $data = $request->data;
14
14
  }
15
15
  }
16
16
  ```
@@ -20,6 +20,8 @@
20
20
  <body>
21
21
  <form method="post" action="/index" >
22
22
  <input type="submit" value='送信'>
23
+    <input type="hidden" name="data"value="{{$date}}"
24
+
23
25
  </form>
24
26
  </body>
25
27
  </html>

2

修正

2019/06/27 05:51

投稿

toll_tree
toll_tree

スコア199

title CHANGED
File without changes
body CHANGED
@@ -28,7 +28,7 @@
28
28
  ```
29
29
  <?php
30
30
  Route::post('/index','TestController@index');
31
- Route::get('/test',TestController@test)
31
+ Route::get('/test','TestController@test')
32
32
  ?>
33
33
  ```
34
34
  ご回答頂けましたら、幸いです。

1

修正

2019/06/26 17:25

投稿

toll_tree
toll_tree

スコア199

title CHANGED
File without changes
body CHANGED
@@ -28,6 +28,7 @@
28
28
  ```
29
29
  <?php
30
30
  Route::post('/index','TestController@index');
31
+ Route::get('/test',TestController@test)
31
32
  ?>
32
33
  ```
33
34
  ご回答頂けましたら、幸いです。