From 73c06277b7a951fdc15ae59b4ab3bdfce77eb878 Mon Sep 17 00:00:00 2001 From: Filip Horvat Date: Sun, 21 Jan 2018 12:18:28 +0100 Subject: [PATCH] change exception description ... --- src/Traits/EloquentJoinTrait.php | 6 +++++- tests/Tests/ExceptionTest.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Traits/EloquentJoinTrait.php b/src/Traits/EloquentJoinTrait.php index 3211562..03d9a72 100644 --- a/src/Traits/EloquentJoinTrait.php +++ b/src/Traits/EloquentJoinTrait.php @@ -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']) + "); } } } diff --git a/tests/Tests/ExceptionTest.php b/tests/Tests/ExceptionTest.php index 8b7305a..01b6892 100644 --- a/tests/Tests/ExceptionTest.php +++ b/tests/Tests/ExceptionTest.php @@ -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);