回答編集履歴
1
BladeテンプレートにCSRF()追加
answer
CHANGED
@@ -6,4 +6,28 @@
|
|
6
6
|
```php
|
7
7
|
Route::get('/helo', 'HeloController@getIndex');
|
8
8
|
Route::post('/helo', 'HeloController@postIndex');
|
9
|
+
```
|
10
|
+
|
11
|
+
**== 追記 ==**
|
12
|
+
**resources/views/helo.blade.php** (Bladeに`{{ csrf_field() }}`を入れる)
|
13
|
+
|
14
|
+
```php
|
15
|
+
<!doctype html>
|
16
|
+
<html>
|
17
|
+
<head>
|
18
|
+
<title>Sample</title>
|
19
|
+
<style>
|
20
|
+
body { color:gray; }
|
21
|
+
h1 { font-size:18pt; font-weight:bold; }
|
22
|
+
</style>
|
23
|
+
</head>
|
24
|
+
<body>
|
25
|
+
<h1>Sample</h1>
|
26
|
+
<p><?php echo $message; ?></p>
|
27
|
+
<form method="post" action="/helo">
|
28
|
+
{{ csrf_field() }}
|
29
|
+
<input type="text" name="str">
|
30
|
+
<input type="submit">
|
31
|
+
</form>
|
32
|
+
</body>
|
9
33
|
```
|