teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

コード追記

2022/05/21 06:29

投稿

Fukusuke0604
Fukusuke0604

スコア555

title CHANGED
File without changes
body CHANGED
@@ -54,7 +54,20 @@
54
54
  return view('show', compact('user', 'image'));
55
55
  }
56
56
  ```
57
+ api.php
58
+ ```PHP
59
+ Route::apiResource('/images', 'ImageApiController');
60
+ Route::get('api/images', 'ImageApiController@index')->name('images.index');
61
+ Route::post('api/images', 'ImageApiController@redirect');
62
+ Route::delete('api/images', 'ImageApiController@destroy');
63
+ ```
57
64
 
65
+ web.php
66
+ ```PHP
67
+ Route::get('show','HomeController@redirect');
68
+ Route::post('show/{image}','HomeController@twitterPost')->name('twitterPost');
69
+ ```
70
+
58
71
  上記コードでローカル環境では、投稿完了後にshow.blade.phpにリダイレクトされ、最新の投稿がshow.blade.phpに表示されます。
59
72
 
60
73
  しかし、herokuにpushすると、なぜひとつ前の投稿が表示され、ページをリロードしないと最新の記事が表示されないのでしょうか?

1

コード修正

2022/05/21 06:07

投稿

Fukusuke0604
Fukusuke0604

スコア555

title CHANGED
File without changes
body CHANGED
@@ -26,9 +26,7 @@
26
26
  $file_name = request()->canvas;
27
27
  $path = Storage::disk('s3')->putFile('/', $file_name, 'public');
28
28
  $image->image = $path;
29
- // request()->canvas->move('storage/images', $path);
30
29
 
31
-
32
30
  //コメント保存処理
33
31
  $image->comment = request('comment');
34
32