質問編集履歴
1
該当コードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -33,4 +33,35 @@
|
|
33
33
|
</form>
|
34
34
|
```
|
35
35
|
エラー内容の確認とformのname周りやタイポなど見ていますが、原因がつかめません。
|
36
|
-
解決するにはどうすればいいでしょうか?
|
36
|
+
解決するにはどうすればいいでしょうか?
|
37
|
+
|
38
|
+
追記:記事の表示部分を掲載し直しました。
|
39
|
+
また掲載して気づいたのですが、@foreach内にformを入れているため、form name="articleOptions"が繰り返し生成されていました。これが悪さをしているのでしょうか?
|
40
|
+
```HTML
|
41
|
+
@foreach ($items as $item)
|
42
|
+
<div class="card my-3">
|
43
|
+
<div class="card-header d-inline-flex pb-0">
|
44
|
+
<h3><a href="article/id/{{ $item->id }}">{{ $item->title }}</a></h3>
|
45
|
+
<div class="ml-auto d-inline-flex">
|
46
|
+
<form name="articleOptions" method="POST">
|
47
|
+
@csrf
|
48
|
+
|
49
|
+
@if ($item->open == \App\Enums\PublicStatus::OPEN) //記事が公開されていれば非公開ボタン
|
50
|
+
<button class="btn btn-secondary btn-sm" formaction="close" name="id"
|
51
|
+
value="{{ $item->id }}">非公開にする</button>
|
52
|
+
@else
|
53
|
+
<button class="btn btn-success btn-sm" formaction="open" name="id"
|
54
|
+
value="{{ $item->id }}">公開する</button>
|
55
|
+
@endif
|
56
|
+
|
57
|
+
<button class="btn btn-primary btn-sm" formaction="edit" name="id"
|
58
|
+
value="{{ $item->id }}">編集</button>
|
59
|
+
|
60
|
+
<button class="btn btn-danger btn-sm" onclick="articleDelete(); return false;" formaction="delete"
|
61
|
+
name="id" value="{{ $item->id }}">削除</button>
|
62
|
+
</form>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
@endforeach
|
67
|
+
```
|