79 lines
2.4 KiB
PHP
79 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace app\models;
|
|
|
|
use Yii;
|
|
use yii\base\Model;
|
|
use yii\data\ActiveDataProvider;
|
|
use app\models\FaceLogs;
|
|
|
|
/**
|
|
* FaceLogsSearch represents the model behind the search form of `app\models\FaceLogs`.
|
|
*/
|
|
class FaceLogsSearch extends FaceLogs {
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function rules() {
|
|
return [
|
|
[['id'], 'integer'],
|
|
[['camera_id', 'confidence', 'enable_door', 'encoded_person_image', 'frametime', 'face_id', 'person_id', 'image', 'status', 'stt', 'timezone', 'name'], 'safe'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@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 = FaceLogs::find();
|
|
|
|
// add conditions that should always apply here
|
|
|
|
$dataProvider = new ActiveDataProvider([
|
|
'query' => $query,
|
|
]);
|
|
|
|
$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([
|
|
'id' => $this->id,
|
|
]);
|
|
|
|
$query->andFilterWhere(['like', 'camera_id', $this->camera_id])
|
|
->andFilterWhere(['like', 'confidence', $this->confidence])
|
|
->andFilterWhere(['like', 'enable_door', $this->enable_door])
|
|
->andFilterWhere(['like', 'encoded_person_image', $this->encoded_person_image])
|
|
->andFilterWhere(['like', 'frametime', $this->frametime])
|
|
->andFilterWhere(['like', 'face_id', $this->face_id])
|
|
->andFilterWhere(['like', 'person_id', $this->person_id])
|
|
->andFilterWhere(['like', 'image', $this->image])
|
|
->andFilterWhere(['like', 'status', $this->status])
|
|
->andFilterWhere(['like', 'stt', $this->stt])
|
|
->andFilterWhere(['like', 'timezone', $this->timezone])
|
|
->andFilterWhere(['like', 'name', $this->name]);
|
|
|
|
return $dataProvider;
|
|
}
|
|
|
|
}
|