->where(['status' => '1','domain' => preg_replace("/^www./","",$_SERVER['HTTP_HOST'])])
class MyActiveQuery extends \yii\db\ActiveQuery
{
public function init()
{
$modelClass = $this->modelClass;
$tableName = $modelClass::tableName();
$domainName = preg_replace("/^www./","",$_SERVER['HTTP_HOST']);
$this->andWhere([$tableName.'.domain' => $domainName]);
parent::init();
}
}
class MyActiveRecord extends \yii\db\ActiveRecord
{
public static function find()
{
return new MyActiveQuery(get_called_class());
}
}