コード例 #1
0
 /**
  * Get events by Facebook event id.
  *
  * @param   QueryBuilder  $query
  * @param   array         $facebookIds
  * @return  QueryBuilder
  */
 public function scopeFacebook($query, array $facebookIds)
 {
     return $query->whereIn('facebook_id', $facebookIds);
 }
コード例 #2
0
ファイル: Topic.php プロジェクト: anqqa/oc-forum-plugin
 /**
  * Search topics and posts.
  *
  * @param   QueryBuilder  $query
  * @param   string        $search
  * @param   bool          $includePosts
  * @return  QueryBuilder
  */
 public function scopeSearch($query, $search, $includePosts = True)
 {
     $search = trim($search);
     if (strlen($search)) {
         $parsed = Search::parseQuery($search, ['topic', 'post'], ['topic' => 'topic', 'post' => 'post', 'author' => 'author', 'by' => 'author']);
         // Search authors?
         $authors = !empty($parsed['author']) ? User::whereIn(DB::raw('LOWER(username)'), $parsed['author'])->lists('id') : [];
         $query->where(function ($query) use($parsed, $authors, $includePosts) {
             if (!empty($parsed['topic'])) {
                 $query->searchWhere(implode(' ', $parsed['topic']), 'name');
                 if ($authors && empty($parsed['post'])) {
                     $query->whereIn('author_id', $authors);
                 }
             }
             if ($includePosts && !empty($parsed['post'])) {
                 $query->orWhereHas('posts', function ($query) use($parsed, $authors) {
                     $query->searchWhere(implode(' ', $parsed['post']), 'post');
                     if ($authors) {
                         $query->whereIn('author_id', $authors);
                     }
                 });
             }
         });
     }
     return $query;
 }
コード例 #3
0
ファイル: _ide_helper.php プロジェクト: Smony/njphoto
 /**
  * Add a "where in" clause to the query.
  *
  * @param string $column
  * @param mixed $values
  * @param string $boolean
  * @param bool $not
  * @return $this 
  * @static 
  */
 public static function whereIn($column, $values, $boolean = 'and', $not = false)
 {
     //Method inherited from \Illuminate\Database\Query\Builder
     return \October\Rain\Database\QueryBuilder::whereIn($column, $values, $boolean, $not);
 }
コード例 #4
0
ファイル: Post.php プロジェクト: anqqa/oc-forum-plugin
 /**
  * Search topics and posts.
  *
  * @param   QueryBuilder  $query
  * @param   string        $search
  * @return  QueryBuilder
  */
 public function scopeSearch($query, $search)
 {
     $parsed = Search::parseQuery($search, ['post'], ['post' => 'post', 'author' => 'author', 'by' => 'author']);
     // Search authors
     $authors = !empty($parsed['author']) ? User::whereIn(DB::raw('LOWER(username)'), $parsed['author'])->lists('id') : [];
     if ($authors) {
         $query->whereIn('author_id', $authors);
     }
     // Search posts
     if (!empty($parsed['post'])) {
         $query->searchWhere(implode(' ', $parsed['post']), 'post');
     }
     return $query;
 }