Your IP : 216.73.216.79


Current Path : /var/www/html/maiwp/backend/models/frontendcontentassign/
Upload File :
Current File : /var/www/html/maiwp/backend/models/frontendcontentassign/FrontendContentAssignSearch.php

<?php

namespace backend\models\frontendcontentassign;

use yii\base\Model;
use yii\data\ActiveDataProvider;

/**
 * FrontendContentAssignSearch represents the model behind the search form about `backend\models\frontendcontentassign\FrontendContentAssign`.
 */
class FrontendContentAssignSearch extends FrontendContentAssign
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['assign_id', 'content_id', 'page_id', 'content_order', 'category_id'], 'integer'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = FrontendContentAssign::find()->innerJoinWith('content');

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => ['pageSize' => false,],
            'sort'=> ['defaultOrder' => ['content_order'=>SORT_ASC]]
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
			'category_id' => $this->category_id,
            'assign_id' => $this->assign_id,
            'content_id' => $this->content_id,
            'frontend_content_assign.page_id' => $this->page_id,
            'content_order' => $this->content_order,
        ]);

        return $dataProvider;
    }
}