Skip to content

Commit d72e3cd

Browse files
committed
formatting
1 parent 5bcee99 commit d72e3cd

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/Illuminate/Database/Eloquent/Relations/MorphTo.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff 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;

tests/Integration/Database/EloquentMorphEagerLoadingTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Illuminate\Tests\Integration\Database\EloquentMorphToLazyEagerLoadingTest;
3+
namespace Illuminate\Tests\Integration\Database\EloquentMorphEagerLoadingTest;
44

55
use Illuminate\Support\Facades\Schema;
66
use 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

0 commit comments

Comments
 (0)