Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Oct 6, 2024
1 parent 0a4ccc3 commit 5b0811b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 2 additions & 7 deletions src/Eloquent/Relations/Traits/HasExistenceQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,8 @@ public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder

$query->getModel()->setTable($hash);

$from = is_string($parentQuery->getQuery()->from)
? $parentQuery->getQuery()->from
// @codeCoverageIgnoreStart
: (string) $parentQuery->getQuery()->from->getValue(
$parentQuery->getQuery()->getGrammar()
);
// @codeCoverageIgnoreEnd
/** @var string $from */
$from = $query->getQuery()->from;

$query->select($columns)->whereColumn(
"$from.$this->localKey",
Expand Down
9 changes: 2 additions & 7 deletions src/HasManyDeep.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,8 @@ protected function performJoin(?Builder $query = null)
$foreignKeys = array_reverse($this->foreignKeys);
$localKeys = array_reverse($this->localKeys);

$from = is_string($query->getQuery()->from)
? $query->getQuery()->from
// @codeCoverageIgnoreStart
: (string) $query->getQuery()->from->getValue(
$query->getQuery()->getGrammar()
);
// @codeCoverageIgnoreEnd
/** @var string $from */
$from = $query->getQuery()->from;

$segments = explode(' as ', $from);

Expand Down

0 comments on commit 5b0811b

Please sign in to comment.