Skip to content

Commit 14dcb6b

Browse files
committed
Parameter $columns can be a string, and must be converted to expected array
1 parent 536316a commit 14dcb6b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Traits/Caching.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Illuminate\Database\Eloquent\Scope;
1111
use Illuminate\Database\Query\Builder;
1212
use Illuminate\Support\Carbon;
13+
use Illuminate\Support\Arr;
1314

1415
trait Caching
1516
{
@@ -130,7 +131,7 @@ protected function getCachePrefix() : string
130131
}
131132

132133
protected function makeCacheKey(
133-
array $columns = ['*'],
134+
$columns = ['*'],
134135
$idColumn = null,
135136
string $keyDifferentiator = ''
136137
) : string {
@@ -158,7 +159,7 @@ protected function makeCacheKey(
158159
}
159160

160161
return (new CacheKey($eagerLoad, $model, $query, $this->macroKey))
161-
->make($columns, $idColumn, $keyDifferentiator);
162+
->make(Arr::wrap($columns), $idColumn, $keyDifferentiator);
162163
}
163164

164165
protected function makeCacheTags() : array

0 commit comments

Comments
 (0)