update Device full CRUD
This commit is contained in:
@@ -10,24 +10,22 @@ use app\models\Device;
|
||||
/**
|
||||
* DeviceSearch represents the model behind the search form of `app\models\Device`.
|
||||
*/
|
||||
class DeviceSearch extends Device
|
||||
{
|
||||
class DeviceSearch extends Device {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
public function rules() {
|
||||
return [
|
||||
[['id', 'status', 'type', 'area_id', 'created_at', 'modified_at'], 'integer'],
|
||||
[['name', 'serial', 'ip_address'], 'safe'],
|
||||
[['id', 'status', 'type', 'area_id'], 'integer'],
|
||||
[['name', 'serial', 'ip_address'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
public function scenarios() {
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
@@ -39,8 +37,7 @@ class DeviceSearch extends Device
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
public function search($params) {
|
||||
$query = Device::find();
|
||||
|
||||
// add conditions that should always apply here
|
||||
@@ -68,9 +65,10 @@ class DeviceSearch extends Device
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'name', $this->name])
|
||||
->andFilterWhere(['like', 'serial', $this->serial])
|
||||
->andFilterWhere(['like', 'ip_address', $this->ip_address]);
|
||||
->andFilterWhere(['like', 'serial', $this->serial])
|
||||
->andFilterWhere(['like', 'ip_address', $this->ip_address]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user