Airship\Cabin\Bridge\Blueprint\Author::toggleOwnerStatus PHP Method

toggleOwnerStatus() public method

Toggle the 'owner' flag.
public toggleOwnerStatus ( integer $authorId, string $uniqueId ) : boolean
$authorId integer
$uniqueId string
return boolean
    public function toggleOwnerStatus(int $authorId, string $uniqueId) : bool
    {
        $this->db->beginTransaction();
        $userID = (int) $this->db->cell('SELECT userid FROM airship_users WHERE uniqueid = ?', $uniqueId);
        if (empty($userID)) {
            throw new UserFeedbackException(\__('There is no user with this Public ID.'));
        }
        if (!$this->userHasAccess($authorId, $userID)) {
            throw new UserFeedbackException(\__("This User doesn't have access to this Author."));
        }
        $this->db->update('hull_blog_author_owners', ['in_charge' => !$this->userIsOwner($authorId, $userID)], ['authorid' => $authorId, 'userid' => $userID]);
        return $this->db->commit();
    }