/**
  * See all users by service
  * @return mixed
  */
 public function actionIndex()
 {
     Yii::$app->user->setReturnUrl(['/' . $this->getRoute()]);
     $userQuery = ApiUser::find()->orderBy('email:1');
     $tenantQuery = Tenant::find()->orderBy('name');
     return $this->render('index', ['userQuery' => $userQuery, 'tenantQuery' => $tenantQuery]);
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Tenant::find();
     $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;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'create_user_id' => $this->create_user_id, 'updated_at' => $this->updated_at, 'update_user_id' => $this->update_user_id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
示例#3
0
 public function actions()
 {
     return ['delete-all' => ['class' => 'anli\\helper\\actions\\DeleteAll', 'modelFullName' => self::MODEL_FULL_NAME, 'noTenant' => true], 'import' => ['class' => 'anli\\helper\\actions\\ImportAction', 'importModelName' => '\\anli\\auth0\\models\\Tenant', 'attributes' => ['name' => 'name']], 'export' => ['class' => 'anli\\helper\\actions\\ExportAction', 'query' => Tenant::find(), 'attributes' => ['name' => 'name']], 'update' => ['class' => 'anli\\helper\\actions\\UpdateAction', 'model' => Tenant::findOne(Yii::$app->getRequest()->getQueryParam('id'))], 'create' => ['class' => 'anli\\helper\\actions\\CreateAction', 'model' => new Tenant()]];
 }
示例#4
0
 /**
  * @return array
  */
 public function getTenantSelect2Data()
 {
     $array = Tenant::find()->select(['{{%tenant}}.id', '{{%tenant}}.name'])->byUser()->asArray()->all();
     return ArrayHelper::map($array, 'id', 'name');
 }