Skip to content

Commit

Permalink
Merge pull request #52 from amvisor/search-in-slug
Browse files Browse the repository at this point in the history
PostScope: also search in 'slug' column
  • Loading branch information
atmonshi authored Oct 4, 2022
2 parents 6230f3a + 822cf3a commit c84f3de
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 c84f3de

Please sign in to comment.