Exemple #1
0
 public static function isOrgOwner($user_id, $org_id)
 {
     return self::find()->from(self::tableName() . ' u')->innerJoin(UsersOrganizations::tableName() . ' uo', 'u.id = uo.user_id')->innerJoin(Organizations::tableName() . ' o', 'o.id = uo.organization_id')->where(['o.id' => $org_id, 'u.id' => $user_id])->exists();
 }
Exemple #2
0
 public static function getByOrg($org_id)
 {
     $sql = 'SELECT u.id, u.username, u.blocked ' . ' FROM ' . Users::tableName() . ' u ' . ' JOIN ' . OrganizationsCashiers::tableName() . ' oc' . ' ON u.id = oc.user_id ' . ' JOIN ' . Organizations::tableName() . ' o ' . ' ON oc.organization_id = o.id ' . ' WHERE o.id = :org_id';
     return Users::findBySql($sql, [':org_id' => $org_id])->asArray()->all();
 }
 public function actionIndex()
 {
     $org_list = Organizations::getByUserId(Yii::$app->user->id);
     return $this->render('index', ['org_list' => $org_list]);
 }