Airship\Cabin\Bridge\Blueprint\Announcements::getForUser PHP Method

getForUser() public method

Get all of the announcements the user has not yet dismissed.
public getForUser ( integer $userID ) : array
$userID integer
return array
    public function getForUser(int $userID) : array
    {
        $query = 'SELECT
                ba.*
            FROM
                bridge_announcements ba
            WHERE
                NOT EXISTS (
                    SELECT 1
                    FROM bridge_announcements_dismiss
                    WHERE userid = ?
                    AND announcementid = ba.announcementid
                )
        ';
        if (!$this->isSuperUser($userID)) {
            $query .= ' AND NOT only_admins';
        }
        $query .= ' ORDER BY created DESC';
        $rows = $this->db->run($query, $userID);
        if (empty($rows)) {
            return [];
        }
        return $rows;
    }