/** * Find posts by their IDs, optionally making sure they are visible to a * certain user. * * @param array $ids * @param \Flarum\Core\Models\User|null $user * @return \Illuminate\Database\Eloquent\Collection */ public function findByIds(array $ids, User $user = null) { $query = Post::whereIn('id', (array) $ids); return $this->scopeVisibleForUser($query, $user)->get(); }