Returns all threads with new messages.

@return \Illuminate\Database\Eloquent\Collection
543049
public function threadsWithNewMessages()
    {
        return $this->threads()
            ->where(function (Builder $q) {
                $q->whereIn(Models::table('threads') . '.id', $this->unreadMessages()->pluck('thread_id'));
            })
            ->get();
    }
897199
protected function getThreadForGuests()
    {
        return $this->_query->joinWith([
                'forum' => function ($query) {
                    $query->andWhere([
                            Forum::tableName() . '.visible' => 1
                        ])->joinWith(['category' => function ($query) {
                            $query->andWhere([Category::tableName() . '.visible' => 1]);
                        }]);
                }
            ])->limit(1)->one();
    }
604009
public function fetchAll()
    {
        $result = $this->statement->fetchAll(\PDO::FETCH_ASSOC);
        $rows = array();

        if ($this->model !== null) {
            foreach ($result as $row) {
                $model = $this->model;
                $rows[] = new $model($row, false);
            }
        } else {
            foreach ($result as $row) {
                $rows[] = $row;
            }
        }

        return $rows;
    }
646703
public function getNewMessagesCount()
    {
        $cache = Podium::getInstance()->podiumCache->getElement('user.newmessages', $this->id);
        if ($cache === false) {
            $cache = (new Query())->from(MessageReceiver::tableName())->where([
                    'receiver_id' => $this->id,
                    'receiver_status' => Message::STATUS_NEW
                ])->count();
            Podium::getInstance()->podiumCache->setElement('user.newmessages', $this->id, $cache);
        }
        return $cache;
    }
587512
public function getMessage()
    {
        $result = [];

        $messages = (isset($this->indexReverse[self::MESSAGE])) ? $this->indexReverse[self::MESSAGE] : [];

        foreach ($messages as $index) {
            $result[] = $this->getChild($index);
        }

        return $result;
    }
1277551
public function getMessages()
    {
        if ($this->event->get('MsgType') === 'text') {
            $text = $this->event->get('Content');
        } else {
            $text = $this->event->get('Url');
        }

        return [
            new IncomingMessage($text, $this->event->get('FromUserName'),
                $this->event->get('ToUserName'), $this->event),
        ];
    }
514263
public function findAll() : array
    {
        $queryBuilder = $this->getQueryBuilder();
        $allRecords = $queryBuilder
            ->select('*')
            ->from($this->table)
            ->execute()->fetchAll();
        return $this->getIndexQueueItemObjectsFromRecords($allRecords);
    }
1249089
public function getModels()
    {
        $all = new Models();

        foreach ($this->items as $item) {
            $all->addAll($item->getCurrentAndOriginal());
        }

        return $all;
    }
377883
public function queue()
    {
        $log = $this->getLogger();
        $log->info('Queueing operation started', array('collections' => count($this)));

        $event = new CollectorEvent($this);
        $this->dispatchEvent(SearchEvents::COLLECTOR_PRE_QUEUE, $event);

        $num_queued = 0;
        foreach ($this->_collections as $collection) {
            $num_queued += $this->queueCollection($collection);
        }

        $this->dispatchEvent(SearchEvents::COLLECTOR_POST_QUEUE, $event);

        $log->info('Queueing operation completed', array('queued' => $num_queued));
        return $num_queued;
    }
419178
public function collection()
    {
        if (!empty($this->response['data'])) {
            $data = [];

            foreach ($this->response['data'] as $object) {
                $data[] = new Fluent($this->resource, $object);
            }

            return $data;
        }

        return [];
    }
797975
public function getCollection()
    {
        $queueDatabase = $this->database;
        $queueResource = $this->collection;
        $db = $this->getAdapter();

        return $db->$queueDatabase->$queueResource;
    }
951931
public function getAll() {
		if ($this->hasAny()) {
			$messages = $_SESSION[self::SESSION_KEY_FLASH];

			$_SESSION[self::SESSION_KEY_FLASH] = [];

			return $messages;
		}
		else {
			return [];
		}
	}
1001197
public function getAll(){
        $rest = $this->getService( self::API_CALL_LOG);
        $rest->GET();

        return $rest->getResultAsArray( models\Call\CallEntry::class);
    }
1307107
public function getMessages()
    {
        $messages = parent::getMessages();

        foreach ($this->pages as $page) {
            $messages = array_merge($messages, $page->getMessages());
        }

        return $messages;
    }
429888
public function getMessages()
    {
        $results  = $this->getResults();
        $messages = [];

        foreach ($results as $result) {
            /** @noinspection SlowArrayOperationsInLoopInspection */
            $messages = array_replace_recursive($messages, $result->getMessages());
        }

        return $messages;
    }
73722
public function getMessages()
    {
        if (empty($this->messages)) {
            $message = new IncomingMessage(Image::PATTERN, $this->event->get('from')['id'], $this->event->get('conversation')['id'],
                $this->payload);
            $message->setImages($this->getImagesUrls());
            $this->messages = [$message];
        }

        return $this->messages;
    }
255375
public function threads()
    {
        $withTrashed = Gate::allows('viewTrashedThreads');
        $query = $this->hasMany(Thread::class);
        return $withTrashed ? $query->withTrashed() : $query;
    }