Skip to content

Commit

Permalink
Add getIntermediateTables() method
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Feb 7, 2024
1 parent 8a2b625 commit 905a6fd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Eloquent/Relations/Traits/RetrievesIntermediateTables.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,14 @@ protected function prefix($accessor)
{
return '__'.$accessor.'__';
}

/**
* Get the intermediate tables.
*
* @return array
*/
public function getIntermediateTables(): array
{
return $this->intermediateTables;
}
}
7 changes: 7 additions & 0 deletions tests/IntermediateTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,11 @@ public function testChunk()
$this->assertTrue($results[0]->relationLoaded('post'));
});
}

public function testGetIntermediateTables()
{
$comments = Country::find(1)->comments();

$this->assertEquals([], $comments->getIntermediateTables());
}
}

0 comments on commit 905a6fd

Please sign in to comment.