Answer the question
In order to leave comments, you need to log in
How to change the search() of the model for a particular case in yii1?
Good afternoon,
There is such a task:
There are 2 actions in the Bids Controller (Applications)
public function actionIndex()
{
$model=new Bids('search');
$model->unsetAttributes();
if(isset($_GET['Bids']))
$model->attributes=$_GET['Bids'];
$this->render('admin',
[
'model'=>$model,
]);
}
public function search()
{
$criteria = new CDbCriteria;
$criteria->compare('id', $this->id);
$criteria->compare('date_start', $this->date_start);
$criteria->compare('customer_id', $this->customer_id);
$criteria->compare('manager_id', $this->manager_id);
$criteria->compare('group_id', $this->group_id);
$criteria->compare('name', $this->name,true);
$criteria->compare('status_id', $this->status_id);
$criteria->addCondition("exist!=".ActiveRecord::EXIST_TRASH);
$criteria->order = 'date_start DESC';
return new CActiveDataProvider($this,
[
'criteria' => $criteria,
]);
}
Answer the question
In order to leave comments, you need to log in
There likely and at users different accesses? Personally, I would divide it into different actions/modules.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question