質問編集履歴
1
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
$filename = '';
|
24
24
|
|
25
|
-
if ($id ==
|
25
|
+
if ($id == true) {
|
26
26
|
|
27
27
|
$filename = (int)$id+1 . '_' . $image->getClientOriginalName(); //id_file.png or .jpngになる
|
28
28
|
|
@@ -64,18 +64,52 @@
|
|
64
64
|
|
65
65
|
口コミとともに投稿する機能のためFormのあるテンプレートと確認のテンプレートの二つを行き来します。
|
66
66
|
|
67
|
-
この返り値がint型ではなく、連想配列で返ってきてるぽくて、質問します。
|
68
67
|
|
69
68
|
|
69
|
+
```
|
70
70
|
|
71
|
-
|
71
|
+
エラー:
|
72
72
|
|
73
|
-
|
73
|
+
Object of class Illuminate\Database\Eloquent\Collection could not be converted to int
|
74
74
|
|
75
|
-
|
75
|
+
```
|
76
76
|
|
77
|
+
どのようにすればidの最新を取得できるのでしょうか?
|
77
78
|
|
79
|
+
ちなみにdatabaseにはあらかじめ何行かデータをinsertしております。
|
78
80
|
|
81
|
+
```mysql
|
82
|
+
|
83
|
+
mysql> select * from provisional_images;
|
84
|
+
|
85
|
+
+----+-------------------------------------------------------+------------------------------------------------------------------------+---------------------+---------------------+
|
86
|
+
|
87
|
+
| id | name | path | created_at | updated_at |
|
88
|
+
|
89
|
+
+----+-------------------------------------------------------+------------------------------------------------------------------------+---------------------+---------------------+
|
90
|
+
|
91
|
+
| 1 | 1_スクリーンショット 2020-02-10 17.40.22.png | public/img/posts/1_スクリーンショット 2020-02-10 17.40.22.png | 2020-04-11 18:52:38 | 2020-04-11 18:52:38 |
|
92
|
+
|
93
|
+
| 2 | 1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | public/img/posts/1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | 2020-04-11 18:55:34 | 2020-04-11 18:55:34 |
|
94
|
+
|
95
|
+
| 3 | 1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | public/img/posts/1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | 2020-04-11 18:56:40 | 2020-04-11 18:56:40 |
|
96
|
+
|
97
|
+
| 4 | 1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | public/img/posts/1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | 2020-04-11 18:56:43 | 2020-04-11 18:56:43 |
|
98
|
+
|
99
|
+
| 5 | 1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | public/img/posts/1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | 2020-04-11 18:57:47 | 2020-04-11 18:57:47 |
|
100
|
+
|
101
|
+
| 6 | 1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | public/img/posts/1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | 2020-04-11 18:58:02 | 2020-04-11 18:58:02 |
|
102
|
+
|
103
|
+
| 7 | 1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | public/img/posts/1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | 2020-04-11 18:58:39 | 2020-04-11 18:58:39 |
|
104
|
+
|
105
|
+
| 8 | 1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | public/img/posts/1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | 2020-04-11 18:58:55 | 2020-04-11 18:58:55 |
|
106
|
+
|
107
|
+
| 9 | 1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | public/img/posts/1_F3E17F18-7B3E-486C-BB06-52D7ADFE0A09.jpeg | 2020-04-11 19:29:53 | 2020-04-11 19:29:53 |
|
108
|
+
|
109
|
+
+----+-------------------------------------------------------+------------------------------------------------------------------------+---------------------+---------------------+
|
110
|
+
|
79
|
-
|
111
|
+
9 rows in set (0.00 sec)
|
112
|
+
|
113
|
+
```
|
80
114
|
|
81
115
|
laravel初心者ですがどうぞお手柔らかによろしくお願いします。
|