getReadIds() public method

Get the IDs of discussions which a user has read completely.
public getReadIds ( User $user ) : array
$user Flarum\Core\User
return array
Example #1
0
 /**
  * {@inheritdoc}
  */
 protected function conditions(AbstractSearch $search, array $matches, $negate)
 {
     if (!$search instanceof DiscussionSearch) {
         throw new LogicException('This gambit can only be applied on a DiscussionSearch');
     }
     $actor = $search->getActor();
     if ($actor->exists) {
         $readIds = $this->discussions->getReadIds($actor);
         $search->getQuery()->where(function ($query) use($readIds, $negate, $actor) {
             if (!$negate) {
                 $query->whereNotIn('id', $readIds)->where('last_time', '>', $actor->read_time ?: 0);
             } else {
                 $query->whereIn('id', $readIds)->orWhere('last_time', '<=', $actor->read_time ?: 0);
             }
         });
     }
 }