Model/ResourceModel/Rules/Collection.php
public function getActiveRuleByWebsiteAndType($type, $websiteId)
    {
        $collection = $this->addFieldToFilter('type', ['eq' => $type])
            ->addFieldToFilter('status', ['eq' => 1])
            ->addFieldToFilter('website_ids', ['finset' => $websiteId])
            ->setPageSize(1);

        if ($collection->getSize()) {
            return $collection->getFirstItem();
        }

        return [];
    }
public function getActiveRuleByWebsiteAndType($type, $websiteId)
    {
        $collection = $this->addFieldToFilter('type', ['eq' => $type])
            ->addFieldToFilter('status', ['eq' => 1])
            ->addFieldToFilter('website_ids', ['finset' => $websiteId])
            ->setPageSize(1);

        if ($collection->getSize()) {
            return $collection->getFirstItem();
        }

        return [];
    }
public function getActiveRuleByWebsiteAndType ( $ type , $ websiteId ) { $ collection = $ this -> addFieldToFilter ( 'type' , [ 'eq' => $ type ] ) -> addFieldToFilter ( 'status' , [ 'eq' => 1 ] ) -> addFieldToFilter ( 'website_ids' , [ 'finset' => $ websiteId ] ) -> setPageSize ( 1 ) ; if ( $ collection -> getSize ( ) ) { return $ collection -> getFirstItem ( ) ; } return [ ] ; }
Get rule for website.

@param string $type
@param int|array $websiteId

@return array|\Magento\Framework\DataObject
Get rule for website .