回答編集履歴
1
リレーションの命名規則に従い修正。
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
if($base->ref_type == 'Hoge') {
|
10
10
|
|
11
|
-
$base->image;
|
11
|
+
$base->images;
|
12
12
|
|
13
13
|
}
|
14
14
|
|
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
// [
|
18
18
|
|
19
|
-
// ['id' => 1, 'ref_id' => 1, 'ref_type' => 'Hoge', 'ref' => [id => 1, 'name' => 'hoge', 'number' => 0, 'image' => ['id' => 1, 'hoge_id' => 1, 'path' => 'image.jpg']]],
|
19
|
+
// ['id' => 1, 'ref_id' => 1, 'ref_type' => 'Hoge', 'ref' => [id => 1, 'name' => 'hoge', 'number' => 0, 'images' => [['id' => 1, 'hoge_id' => 1, 'path' => 'image.jpg']]]],
|
20
20
|
|
21
21
|
// ['id' => 2, 'ref_id' => 1, 'ref_type' => 'Fuga', 'ref' => [id => 1, 'name' => 'fuga', 'text' => 'a']],
|
22
22
|
|