File tree Expand file tree Collapse file tree
src/Illuminate/Database/Eloquent/Relations
tests/Integration/Database Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class MorphTo extends BelongsTo
4242 *
4343 * @var array
4444 */
45- protected $ typedEagerLoads = [];
45+ protected $ morphableEagerLoads = [];
4646
4747 /**
4848 * Create a new morph to relationship instance.
@@ -120,7 +120,7 @@ protected function getResultsByType($type)
120120 ->mergeConstraintsFrom ($ this ->getQuery ())
121121 ->with (array_merge (
122122 $ this ->getQuery ()->getEagerLoads (),
123- (array ) ($ this ->typedEagerLoads [get_class ($ instance )] ?? [])
123+ (array ) ($ this ->morphableEagerLoads [get_class ($ instance )] ?? [])
124124 ));
125125
126126 return $ query ->whereIn (
@@ -269,11 +269,10 @@ public function getDictionary()
269269 * @param array $with
270270 * @return \Illuminate\Database\Eloquent\Relations\MorphTo
271271 */
272- public function withMorph (array $ with )
272+ public function morphWith (array $ with )
273273 {
274- $ this ->typedEagerLoads = array_merge (
275- $ this ->typedEagerLoads ,
276- $ with
274+ $ this ->morphableEagerLoads = array_merge (
275+ $ this ->morphableEagerLoads , $ with
277276 );
278277
279278 return $ this ;
Original file line number Diff line number Diff line change 11<?php
22
3- namespace Illuminate \Tests \Integration \Database \EloquentMorphToLazyEagerLoadingTest ;
3+ namespace Illuminate \Tests \Integration \Database \EloquentMorphEagerLoadingTest ;
44
55use Illuminate \Support \Facades \Schema ;
66use Illuminate \Database \Eloquent \Model ;
@@ -50,7 +50,7 @@ public function test_with_morph_loading()
5050 {
5151 $ comments = Comment::query ()
5252 ->with (['commentable ' => function (MorphTo $ morphTo ) {
53- $ morphTo ->withMorph ([Post::class => ['user ' ]]);
53+ $ morphTo ->morphWith ([Post::class => ['user ' ]]);
5454 }])
5555 ->get ();
5656
@@ -63,7 +63,7 @@ public function test_with_morph_loading_with_single_relation()
6363 {
6464 $ comments = Comment::query ()
6565 ->with (['commentable ' => function (MorphTo $ morphTo ) {
66- $ morphTo ->withMorph ([Post::class => 'user ' ]);
66+ $ morphTo ->morphWith ([Post::class => 'user ' ]);
6767 }])
6868 ->get ();
6969
You can’t perform that action at this time.
0 commit comments