Skip to content

Commit 73fad31

Browse files
Merge pull request #29 from drsdre/drsdre-patch-scopeForKey
2 parents 528953c + f3c44fc commit 73fad31

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Models/Projection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function scopePeriod(Builder $query, string $period): Builder
103103
/**
104104
* Scopes a query to filter by key.
105105
*/
106-
public function scopeKey(Builder $query, array|string|int $keys): Builder
106+
public function scopeForKey(Builder $query, array|string|int $keys): Builder
107107
{
108108
if (is_array($keys)) {
109109
return $query->where(function ($query) use (&$keys) {

tests/ProjectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function it_gets_the_projection_from_a_single_key()
149149
$log = $this->createModelWithProjections(Log::class, [SinglePeriodProjectionWithUniqueKey::class]);
150150
$this->createModelWithProjections(Log::class, [SinglePeriodProjectionWithUniqueKey::class]);
151151

152-
$numberOfProjections = Projection::key($log->id)->count();
152+
$numberOfProjections = Projection::forKey($log->id)->count();
153153

154154
$this->assertEquals(1, $numberOfProjections);
155155
}
@@ -160,7 +160,7 @@ public function it_gets_the_projections_from_multiples_keys()
160160
$log = $this->createModelWithProjections(Log::class, [SinglePeriodProjectionWithUniqueKey::class]);
161161
$anotherLog = $this->createModelWithProjections(Log::class, [SinglePeriodProjectionWithUniqueKey::class]);
162162

163-
$numberOfProjections = Projection::key([$log->id, $anotherLog->id])->count();
163+
$numberOfProjections = Projection::forKey([$log->id, $anotherLog->id])->count();
164164

165165
$this->assertEquals(2, $numberOfProjections);
166166
}

0 commit comments

Comments
 (0)