diff --git a/backend/controllers/DoctorController.php b/backend/controllers/DoctorController.php index 0190748..289cca5 100644 --- a/backend/controllers/DoctorController.php +++ b/backend/controllers/DoctorController.php @@ -156,7 +156,8 @@ 'hasAlias' => true, 'languageFields' => [ - [ + + [ 'name' => 'name', 'type' => Form::STRING, 'decorate' => true @@ -171,6 +172,10 @@ ], ], 'fields' => [ + [ + 'name' => 'sort', + 'type' => Form::NUMBER, + ], [ 'name' => 'image_id', 'type' => Form::IMAGE @@ -186,10 +191,7 @@ 'name' => 'status', 'type' => Form::BOOL, ], - [ - 'name' => 'sort', - 'type' => Form::NUMBER, - ], + ], ]; } diff --git a/common/models/Doctor.php b/common/models/Doctor.php index 1832a6d..7f05994 100644 --- a/common/models/Doctor.php +++ b/common/models/Doctor.php @@ -55,10 +55,10 @@ class Doctor extends \yii\db\ActiveRecord ); }, ], - 'positionBehavior' => [ - 'class' => PositionBehavior::className(), - 'positionAttribute' => 'sort', - ], +// 'positionBehavior' => [ +// 'class' => PositionBehavior::className(), +// 'positionAttribute' => 'sort', +// ], ]; } /** diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index acd8d23..4d9da64 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -294,6 +294,10 @@ { $doctors = Doctor::find() ->where(['status' => true]) + ->orderBy([ + 'sort' => SORT_ASC, + 'id' => SORT_ASC + ]) ->all(); return $this->render('doctor', -- libgit2 0.21.4