Skip to content

Commit

Permalink
PostScope: also search in 'slug' column
Browse files Browse the repository at this point in the history
  • Loading branch information
Herbert Maschke committed Oct 4, 2022
1 parent 6230f3a commit 822cf3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Models/PostScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function scopeSearch($query, $term)
}

return $query->where(function ($query) use ($term) {
foreach (['title', 'content', 'description'] as $attribute) {
foreach (['title', 'slug', 'content', 'description'] as $attribute) {
$query->orWhere(DB::raw("lower($attribute)"), 'like', "%$term%");
}

Expand Down

0 comments on commit 822cf3a

Please sign in to comment.