質問編集履歴
4
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,7 +42,7 @@
|
|
42
42
|
|
43
43
|
<input type="submit" value='送信'>
|
44
44
|
|
45
|
-
<input type="hidden" name="data"value="{{$date}}"
|
45
|
+
<input type="hidden" name="data"value="{{$date}}">
|
46
46
|
|
47
47
|
|
48
48
|
|
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
post、またはgetにより、変数データ(オブジェクト)をコントローラー部分へ送る方法はありますでしょうか?
|
2
2
|
|
3
|
-
具体的には下記コードTestController.phpの「test」メソッド内にて、index.blade.phpへ送った$date
|
3
|
+
具体的には下記コードTestController.phpの「test」メソッド内にて、index.blade.phpへ送った$dateを、index.blade.phpのフォーム内にて組み込み、TestControllerの「index」メソッド内にて、ルーティングを通し渡したいです。
|
4
4
|
|
5
5
|
以下は、TestController.phpです。
|
6
6
|
|
@@ -20,9 +20,9 @@
|
|
20
20
|
|
21
21
|
}
|
22
22
|
|
23
|
-
public function index(){
|
23
|
+
public function index(Request $request){
|
24
24
|
|
25
|
-
|
25
|
+
$data = $request->data;
|
26
26
|
|
27
27
|
}
|
28
28
|
|
@@ -41,6 +41,10 @@
|
|
41
41
|
<form method="post" action="/index" >
|
42
42
|
|
43
43
|
<input type="submit" value='送信'>
|
44
|
+
|
45
|
+
<input type="hidden" name="data"value="{{$date}}"
|
46
|
+
|
47
|
+
|
44
48
|
|
45
49
|
</form>
|
46
50
|
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -58,7 +58,7 @@
|
|
58
58
|
|
59
59
|
Route::post('/index','TestController@index');
|
60
60
|
|
61
|
-
Route::get('/test',TestController@test)
|
61
|
+
Route::get('/test','TestController@test')
|
62
62
|
|
63
63
|
?>
|
64
64
|
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -58,6 +58,8 @@
|
|
58
58
|
|
59
59
|
Route::post('/index','TestController@index');
|
60
60
|
|
61
|
+
Route::get('/test',TestController@test)
|
62
|
+
|
61
63
|
?>
|
62
64
|
|
63
65
|
```
|