Exemple #1
0
 /**
  * Filter the title or body by keyword
  *
  * @param Relations\HasMany $query
  * @param string            $keyword
  *
  * @return void
  */
 public function filterTitleOrBody(Relations\HasMany $query, $keyword)
 {
     if (!empty($keyword)) {
         $query->where(function (Eloquent\Builder $query) use($keyword) {
             $query->where('title', 'like', '%' . $keyword . '%');
             $query->orWhere('body', 'like', '%' . $keyword . '%');
         });
     }
 }