common/models/traits/base/FeaturedTrait.php
public static function queryByFeatured( $config = [] ) {

		$ignoreSite	= isset( $config[ 'ignoreSite' ] ) ? $config[ 'ignoreSite' ] : false;
		$limit		= isset( $config[ 'limit' ] ) ? $config[ 'limit' ] : 10;
		$query		= null;

		if( static::isMultiSite() && !$ignoreSite ) {

			$siteId	= isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId;

			$query = static::find()->where( 'featured=:featured AND siteId=:siteId', [ ':featured' => true, ':siteId' => $siteId ] );
		}
		else {

			$query = static::find()->where( 'featured=:featured', [ ':featured' => true ] );
		}

		$query->limit( $limit );

		return $query;
	}
public static function queryByFeatured( $config = [] ) {

		$ignoreSite	= isset( $config[ 'ignoreSite' ] ) ? $config[ 'ignoreSite' ] : false;
		$limit		= isset( $config[ 'limit' ] ) ? $config[ 'limit' ] : 10;
		$query		= null;

		if( static::isMultiSite() && !$ignoreSite ) {

			$siteId	= isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId;

			$query = static::find()->where( 'featured=:featured AND siteId=:siteId', [ ':featured' => true, ':siteId' => $siteId ] );
		}
		else {

			$query = static::find()->where( 'featured=:featured', [ ':featured' => true ] );
		}

		$query->limit( $limit );

		return $query;
	}
public static function queryByFeatured ( $ config = [ ] ) { $ ignoreSite = isset ( $ config [ 'ignoreSite' ] ) ? $ config [ 'ignoreSite' ] : false ; $ limit = isset ( $ config [ 'limit' ] ) ? $ config [ 'limit' ] : 10 ; $ query = null ; if ( static :: isMultiSite ( ) && ! $ ignoreSite ) { $ siteId = isset ( $ config [ 'siteId' ] ) ? $ config [ 'siteId' ] : Yii :: $ app -> core -> siteId ; $ query = static :: find ( ) -> where ( 'featured=:featured AND siteId=:siteId' , [ ':featured' => true , ':siteId' => $ siteId ] ) ; } else { $ query = static :: find ( ) -> where ( 'featured=:featured' , [ ':featured' => true ] ) ; } $ query -> limit ( $ limit ) ; return $ query ; }
Generate and return the query to filter featured models based on multi-site configuration.

@param array $config
@return \yii\db\ActiveQuery
Generate and return the query to filter featured models based on multi - site configuration .