Skip to content

Commit b0f29b2

Browse files
committed
Explicitly use parameter binding to prevent generating mangled FQN projection names because of backslash escaping i.e. prevent App\Models\Class to AppModelsClass.
1 parent ed118eb commit b0f29b2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Models/Projection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function scopeName(Builder $query, string $projectorName): Builder
8787
{
8888
$this->projectionName = $projectorName;
8989

90-
return $query->where('projection_name', $projectorName);
90+
return $query->whereRaw('projection_name = ?', [$projectorName]);
9191
}
9292

9393
/**

src/Models/Scopes/ProjectionScope.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ProjectionScope implements Scope
1515
public function apply(Builder $builder, Model $model): void
1616
{
1717
if (! $this->isAbstractProjection($model)) {
18-
$builder->where('projection_name', $model::class);
18+
$builder->whereRaw('projection_name = ?', [$model::class]);
1919
}
2020
}
2121

src/Models/Traits/Projectable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function projections(
5252
$query = $this->morphToMany(Projection::class, 'projectable', 'time_series_projectables');
5353

5454
if (isset($projectionName)) {
55-
$query->where('projection_name', $projectionName);
55+
$query->whereRaw('projection_name = ?', [$projectionName]);
5656
}
5757

5858
if (isset($periods) && is_string($periods)) {

0 commit comments

Comments
 (0)