質問編集履歴
1
コード修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,10 +13,10 @@
|
|
13
13
|
|
14
14
|
public function destroy(Post $post)
|
15
15
|
{
|
16
|
+
//'public/images'.ファイル名を$delItemに代入
|
17
|
+
$delItem = 'public/images'.$post->image;
|
16
|
-
|
18
|
+
// $delItemを削除する
|
17
|
-
$delItem = $post->image;
|
18
|
-
// storage/app/public/imagesから、画像ファイルを削除する
|
19
|
-
Storage::delete(
|
19
|
+
Storage::delete($delItem);
|
20
20
|
|
21
21
|
$post->delete();
|
22
22
|
return redirect()->route('home')->with('message', '投稿を削除しました');
|