search by title and slug
This commit is contained in:
parent
8a7e53902e
commit
8477728363
|
|
@ -14,7 +14,7 @@ scopes:
|
|||
label: Post Title
|
||||
type: text
|
||||
modelClass: RainLab\Blog\Models\Post
|
||||
scope: FilterId
|
||||
scope: FilterName
|
||||
|
||||
category:
|
||||
|
||||
|
|
|
|||
|
|
@ -537,13 +537,16 @@ class Post extends Model
|
|||
return $query->where('id', $id);
|
||||
}
|
||||
|
||||
public function scopeFilterName($query, $q)
|
||||
public function scopeFilterName($query, $name)
|
||||
{
|
||||
|
||||
return $query = where('title','LIKE','%'.$q.'%')
|
||||
->orWhere('slug','LIKE','%'.$q.'%');
|
||||
return $query->where('title','LIKE','%'.$name.'%')->orWhere('slug','LIKE','%'.$name.'%');
|
||||
}
|
||||
|
||||
// public function scopeFilterName($query, $name)
|
||||
// {
|
||||
// return $query = where('title','LIKE','%'.$name.'%');
|
||||
// }
|
||||
|
||||
public function scopeFilterLocale($query, array $types) {
|
||||
foreach ($types as $type) {
|
||||
switch ($type) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue