models/FileSearch.php
public function search($params)
    {
        $query = $this->find();
        
                
        $query->joinWith([/**/]);

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        
        /* uncomment to sort by relations table on respective column*/

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }				
		
        $query->andFilterWhere([
            'status' => $this->status,
            /**/
        ]);

        $params = self::queryNumber([['id',$this->tableName()],['isdel']]);
		foreach ($params as $p)
		{
			$query->andFilterWhere($p);
		}
        $params = self::queryString([['title'],['description'],['file'],['tags']]);
		foreach ($params as $p)
		{
			$query->andFilterWhere($p);
		}
        $params = self::queryTime([['time']]);
		foreach ($params as $p)
		{
			$query->andFilterWhere($p);
		}
				
		/* example to use search all in field1,field2,field3 or field4
		if ($this->term)
		{
			$query->andFilterWhere(["OR","lower(field1) like '%".strtolower($this->term)."%'",
				["OR","lower(field2) like '%".strtolower($this->term)."%'",
					["OR","lower(field3) like '%".strtolower($this->term)."%'",
						"lower(field4) like '%".strtolower($this->term)."%'"						
					]
				]
			]);	
		}	
		*/
		
		$query->andFilterWhere(["like","lower(concat(title,description,file))",strtolower($this->term)]);

        return $dataProvider;
    }
public function search($params)
    {
        $query = $this->find();
        
                
        $query->joinWith([/**/]);

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        
        /* uncomment to sort by relations table on respective column*/

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }				
		
        $query->andFilterWhere([
            'status' => $this->status,
            /**/
        ]);

        $params = self::queryNumber([['id',$this->tableName()],['isdel']]);
		foreach ($params as $p)
		{
			$query->andFilterWhere($p);
		}
        $params = self::queryString([['title'],['description'],['file'],['tags']]);
		foreach ($params as $p)
		{
			$query->andFilterWhere($p);
		}
        $params = self::queryTime([['time']]);
		foreach ($params as $p)
		{
			$query->andFilterWhere($p);
		}
				
		/* example to use search all in field1,field2,field3 or field4
		if ($this->term)
		{
			$query->andFilterWhere(["OR","lower(field1) like '%".strtolower($this->term)."%'",
				["OR","lower(field2) like '%".strtolower($this->term)."%'",
					["OR","lower(field3) like '%".strtolower($this->term)."%'",
						"lower(field4) like '%".strtolower($this->term)."%'"						
					]
				]
			]);	
		}	
		*/
		
		$query->andFilterWhere(["like","lower(concat(title,description,file))",strtolower($this->term)]);

        return $dataProvider;
    }
public function search ( $ params ) { $ query = $ this -> find ( ) ; $ query -> joinWith ( [ /**/ ] ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , ] ) ; /* uncomment to sort by relations table on respective column*/ if ( ! ( $ this -> load ( $ params ) && $ this -> validate ( ) ) ) { return $ dataProvider ; } $ query -> andFilterWhere ( [ 'status' => $ this -> status , /**/ ] ) ; $ params = self :: queryNumber ( [ [ 'id' , $ this -> tableName ( ) ] , [ 'isdel' ] ] ) ; foreach ( $ params as $ p ) { $ query -> andFilterWhere ( $ p ) ; } $ params = self :: queryString ( [ [ 'title' ] , [ 'description' ] , [ 'file' ] , [ 'tags' ] ] ) ; foreach ( $ params as $ p ) { $ query -> andFilterWhere ( $ p ) ; } $ params = self :: queryTime ( [ [ 'time' ] ] ) ; foreach ( $ params as $ p ) { $ query -> andFilterWhere ( $ p ) ; } /* example to use search all in field1,field2,field3 or field4
		if ($this->term)
		{
			$query->andFilterWhere(["OR","lower(field1) like '%".strtolower($this->term)."%'",
				["OR","lower(field2) like '%".strtolower($this->term)."%'",
					["OR","lower(field3) like '%".strtolower($this->term)."%'",
						"lower(field4) like '%".strtolower($this->term)."%'"						
					]
				]
			]);	
		}	
		*/ $ query -> andFilterWhere ( [ "like" , "lower(concat(title,description,file))" , strtolower ( $ this -> term ) ] ) ; return $ dataProvider ; }
Creates data provider instance with search query applied

@param array $params

@return ActiveDataProvider
Creates data provider instance with search query applied