質問編集履歴

2

省略

2021/09/08 02:30

投稿

purinch
purinch

スコア1

test CHANGED
File without changes
test CHANGED
@@ -28,23 +28,7 @@
28
28
 
29
29
  //新規投稿
30
30
 
31
- public function createForm(Request $request)
32
31
 
33
- {
34
-
35
- $post = $request->input('newPost');
36
-
37
- \DB::table('posts')->insert([
38
-
39
- 'post' => $post,
40
-
41
- 'user_id' => Auth::user()->id,
42
-
43
- ]);
44
-
45
- return redirect('/top');
46
-
47
- }
48
32
 
49
33
  //投稿更新
50
34
 
@@ -69,113 +53,3 @@
69
53
  }
70
54
 
71
55
  ```
72
-
73
-
74
-
75
-
76
-
77
- ```indexblade
78
-
79
- @foreach ($list as $list)
80
-
81
- @if ($list->user->id === Auth::user()->id)
82
-
83
- <tr class="if">
84
-
85
- <td class="edit">
86
-
87
- <a data-toggle="modal" data-target="#testModal"><input class="edit" type="image" src="images/edit.png"></a>
88
-
89
- </td>
90
-
91
- <td class=delete>
92
-
93
- <form method="post"  action="/post/delete/{id}">
94
-
95
- {{ csrf_field() }}
96
-
97
- {{ method_field('delete') }}
98
-
99
- <input type="hidden" name="id" value="{{$list->id}}">
100
-
101
- <a onclick="return confirm('このつぶやきを削除します。よろしいでしょうか?')"><input class="image btn-dell" type="image" src="images/trash_h.png" value="send"></a>
102
-
103
- </form>
104
-
105
- </td>
106
-
107
- </tr>
108
-
109
- @endif
110
-
111
- </tr>
112
-
113
- <div class="modal fade" id="testModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
114
-
115
- <div class="modal-dialog">
116
-
117
- <div class="modal-content">
118
-
119
- <div>
120
-
121
- {!! Form::open(['url' => 'top','method'=>'post','route'=>'updatePost']) !!}
122
-
123
- <input type="hidden" name="_method" value="PUT">
124
-
125
- <input id="id" class="form-control" type="hidden" name="id" value="">
126
-
127
- <input id="post" class="form-control" type="text" name="upPost" value="">
128
-
129
- {{ csrf_field() }}
130
-
131
- {{ method_field('put') }}
132
-
133
- {!! Form::textarea('post', $list->post,null,['class' => 'form-control','cols'=>'30','rows'=>'10','maxlength'=>'150']) !!}
134
-
135
- <input type="image" src="images/edit.png">
136
-
137
- {!! Form::close() !!}
138
-
139
- </div>
140
-
141
- <div class="modal-footer">
142
-
143
- <button type="button" class="btn btn-default" data-dismiss="modal">閉じる</button>
144
-
145
- </div>
146
-
147
- </div>
148
-
149
- </div>
150
-
151
-
152
-
153
- </div>
154
-
155
- </div>
156
-
157
- @endforeach
158
-
159
- }
160
-
161
- ```
162
-
163
- ```webphp
164
-
165
- Route::put('/top', 'PostsController@updatepost')->name('updatePost');
166
-
167
- ````
168
-
169
- ### 試したこと
170
-
171
-
172
-
173
- Findを試しましたがうまくいきませんでした。
174
-
175
-
176
-
177
- ### 補足情報(FW/ツールのバージョンなど)
178
-
179
-
180
-
181
- ここにより詳細な情報を記載してください。

1

コード省略

2021/09/08 02:30

投稿

purinch
purinch

スコア1

test CHANGED
File without changes
test CHANGED
@@ -77,18 +77,6 @@
77
77
  ```indexblade
78
78
 
79
79
  @foreach ($list as $list)
80
-
81
- <tr class="timeline">
82
-
83
- <td><a href="{{ url('profile'.$list->user->id) }}"><img src="{{ $list->user->image }}" class="user_image" width="1" height="1"></a></td>
84
-
85
- <td><a href="{{ url('profile'.$list->user->id) }}" class="user_name">{{ $list->user->username }}</td></a>
86
-
87
- <td class="created_at">{{ $list->created_at }}</td>
88
-
89
- <td class="post">{{ $list->post }}</td>
90
-
91
-
92
80
 
93
81
  @if ($list->user->id === Auth::user()->id)
94
82