Skip to content

Commit

Permalink
change exception description ...
Browse files Browse the repository at this point in the history
  • Loading branch information
fico7489 committed Jan 21, 2018
1 parent 741756e commit 73c0627
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Traits/EloquentJoinTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ private function validateJoinQuery($relatedModel)

foreach ($relatedModel->relationWhereClauses as $relationWhereClause) {
if (empty($relationWhereClause['column']) || ! is_string($relationWhereClause['column'])) {
throw new EloquentJoinException("Only this where type ->where('column', 'operator', 'value') is allowed on HasOneJoin and BelongsToJoin relations.");
throw new EloquentJoinException("Only this where types are allowed on HasOneJoin and BelongsToJoin relations :
->where('column', 'operator', 'value')
->where('column', 'value')
->where(['column' => 'value'])
");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Tests/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testInvalidWhere()
try {
Seller::whereJoin('locationPrimaryInvalid2.name', '=', 'test')->get();
} catch (EloquentJoinException $e) {
$this->assertEquals("Only this where type ->where('column', 'operator', 'value') is allowed on HasOneJoin and BelongsToJoin relations.", $e->getMessage());
$this->assertContains("on HasOneJoin and BelongsToJoin relations", $e->getMessage());
return;
}
$this->assertTrue(false);
Expand Down

0 comments on commit 73c0627

Please sign in to comment.