diff --git a/plugins/rainlab/blog/controllers/posts/config_filter.yaml b/plugins/rainlab/blog/controllers/posts/config_filter.yaml index 49e6e5612..fbded84a9 100644 --- a/plugins/rainlab/blog/controllers/posts/config_filter.yaml +++ b/plugins/rainlab/blog/controllers/posts/config_filter.yaml @@ -10,7 +10,12 @@ scopes: modelClass: RainLab\Blog\Models\Post scope: FilterId # conditions: id in (:filtered) - + title: + label: Post Title + type: text + modelClass: RainLab\Blog\Models\Post + scope: FilterId + category: # Filter name diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 57b67c694..06df23469 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -536,6 +536,13 @@ class Post extends Model { return $query->where('id', $id); } + + public function scopeFilterName($query, $q) + { + + return $query = where('title','LIKE','%'.$q.'%') + ->orWhere('slug','LIKE','%'.$q.'%'); + } public function scopeFilterLocale($query, array $types) { foreach ($types as $type) {