- <?php
-
-
-
- namespace backend\controllers\admin;
-
- use backend\controllers\BackendController;
- use domain\Order\Order\OrderSearch;
- use yii\filters\AccessControl;
-
- class OrderAdminController extends BackendController
- {
- public function behaviors()
- {
- return [
- 'access' => [
- 'class' => AccessControl::class,
- 'rules' => [
- [
- 'allow' => true,
- 'roles' => ['@'],
- 'matchCallback' => function ($rule, $action) {
- return $this->getUserModule()
- ->getAuthorizationChecker()
- ->isGrantedAsAdministrator($this->getUserCurrent());
- }
- ]
- ],
- ],
- ];
- }
-
- public function actionIndex()
- {
- $searchModel = new OrderSearch();
- $dataProvider = $searchModel->search([
- 'order_by' => 'IF(ISNULL(date_update), `order`.`date`, `order`.`date_update`) DESC'
- ]);
-
- return $this->render('index', [
- 'searchModel' => $searchModel,
- 'dataProvider' => $dataProvider,
- ]);
- }
- }
|