質問編集履歴
1
コード追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,6 +24,58 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
|
27
|
+
---
|
28
28
|
|
29
|
+
**hogeController.php**
|
30
|
+
|
31
|
+
```php
|
32
|
+
|
33
|
+
public function store(Request $request)
|
34
|
+
|
35
|
+
{
|
36
|
+
|
37
|
+
$validatedData = $request->validate([
|
38
|
+
|
39
|
+
'name' => 'required|max:30',
|
40
|
+
|
41
|
+
]);
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
**hoge.blade.php**
|
50
|
+
|
51
|
+
```php
|
52
|
+
|
29
|
-
n
|
53
|
+
@if ($errors->any())
|
54
|
+
|
55
|
+
<div class="alert alert-danger">
|
56
|
+
|
57
|
+
<ul>
|
58
|
+
|
59
|
+
@foreach($errors->all() as $error)
|
60
|
+
|
61
|
+
<li>{{ $error }}</li>
|
62
|
+
|
63
|
+
@endforeach
|
64
|
+
|
65
|
+
</ul>
|
66
|
+
|
67
|
+
</div>
|
68
|
+
|
69
|
+
@endif
|
70
|
+
|
71
|
+
{{ csrf_field() }}
|
72
|
+
|
73
|
+
```
|
74
|
+
|
75
|
+
**web.app**
|
76
|
+
|
77
|
+
```php
|
78
|
+
|
79
|
+
Route::post('/hoge', 'hogeController@store');
|
80
|
+
|
81
|
+
```
|