findWhere() публичный Метод

Find posts that match certain conditions, optionally making sure they are visible to a certain user, and/or using other criteria.
public findWhere ( array $where = [], User $actor = null, array $sort = [], integer $count = null, integer $start ) : Illuminate\Database\Eloquent\Collection
$where array
$actor Flarum\Core\User
$sort array
$count integer
$start integer
Результат Illuminate\Database\Eloquent\Collection
Пример #1
0
 /**
  * @param ServerRequestInterface $request
  * @param array $where
  * @return \Illuminate\Database\Eloquent\Collection
  * @throws InvalidParameterException
  */
 private function getPosts(ServerRequestInterface $request, array $where)
 {
     $queryParams = $request->getQueryParams();
     $actor = $request->getAttribute('actor');
     $sort = $this->extractSort($request);
     $limit = $this->extractLimit($request);
     if (($near = array_get($queryParams, 'page.near')) > 1) {
         if (count($where) > 1 || !isset($where['discussion_id']) || $sort) {
             throw new InvalidParameterException('You can only use page[near] with ' . 'filter[discussion] and the default sort order');
         }
         $offset = $this->posts->getIndexForNumber($where['discussion_id'], $near, $actor);
         $offset = max(0, $offset - $limit / 2);
     } else {
         $offset = $this->extractOffset($request);
     }
     return $this->posts->findWhere($where, $actor, $sort, $limit, $offset);
 }