Commit 02486e9e by san58

добавил условие

1 parent 11fd8319
...@@ -46,8 +46,17 @@ class HostFreeController extends Controller ...@@ -46,8 +46,17 @@ class HostFreeController extends Controller
*/ */
public function actionIndex() public function actionIndex()
{ {
$searchModel = new HostSearch(['wis_status' => Host::STATUS_WIS_FREE, 'status' => Filter::STATUS_ON, 'f1_status' => Filter::STATUS_ON]); $searchModel = new HostSearch([
'wis_status' => Host::STATUS_WIS_FREE,
'status' => Filter::STATUS_ON,
'f1_status' => Filter::STATUS_ON,
'free' => true
// AND ( f2_status=Filter::STATUS_ON OR f3_status=Filter::STATUS_ON )
]);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider->setSort([ $dataProvider->setSort([
'defaultOrder' => [ 'defaultOrder' => [
......
...@@ -32,6 +32,8 @@ class Host extends \yii\db\ActiveRecord ...@@ -32,6 +32,8 @@ class Host extends \yii\db\ActiveRecord
public $cnt; public $cnt;
public $free = false;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -74,6 +74,13 @@ class HostSearch extends Host ...@@ -74,6 +74,13 @@ class HostSearch extends Host
$query->andFilterWhere(['like', 'domain', $this->domain]); $query->andFilterWhere(['like', 'domain', $this->domain]);
if ($this->free === true) {
$query->andFilterWhere(['or',
['f2_status'=>Filter::STATUS_ON],
['f3_status'=>Filter::STATUS_ON]
]);
}
return $dataProvider; return $dataProvider;
} }
} }
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!