Inheritance: extends app\models\MainActiveRecord
コード例 #1
0
ファイル: PromoForm.php プロジェクト: DezMonT765/beacon-cms
 /**
  * Signs user up.
  *
  * @return Users|null the saved model or null if saving fails
  */
 public function register()
 {
     $user = null;
     $transaction = Yii::$app->db->beginTransaction();
     try {
         $group = new Groups();
         $group->name = $this->email;
         if ($group->save()) {
             $user = parent::register($group->id);
             for ($i = 0; $i < $this->beacon_count; $i++) {
                 $beacon = new Beacons();
                 $beacon->name = Yii::$app->security->generateRandomString(16);
                 $beacon->title = "Such title {$i}";
                 $beacon->description = "So description {$i}";
                 $beacon->minor = $group->id . $user->id . $i;
                 $beacon->major = $group->id . $user->id . $i;
                 $beacon->place = "Wow Place {$i}";
                 $beacon->uuid = UUID::v4();
                 $beacon->groupToBind = $group->id;
                 $beacon->save();
             }
         }
         $transaction->commit();
         return $user;
     } catch (Exception $e) {
         if ($transaction->isActive) {
             $transaction->rollBack();
         }
         return null;
     }
 }
コード例 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param null $user_id
  * @param null $group_id
  * @throws \yii\web\NotFoundHttpException
  * @return ActiveDataProvider
  */
 public function search($user_id = null, $group_id = null)
 {
     $query = Beacons::find();
     if (!Yii::$app->user->can(RbacController::admin)) {
         $user = Users::getLogged(true);
         $user->getBeaconsQuery($query);
     }
     if ($user_id !== null) {
         $user = Users::findOne(['id' => $user_id]);
         $user->getBeaconsQuery($query);
     }
     if ($group_id !== null) {
         $group = Groups::findOne(['id' => $group_id]);
         $query = $group->getBeacons();
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'minor' => $this->minor, 'major' => $this->major]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'uuid', $this->uuid]);
     return $dataProvider;
 }
コード例 #3
0
ファイル: HomeController.php プロジェクト: quenti77/easyhq
 public function index()
 {
     if (!Groups::check('site', Groups::getAuth('site', 'show_admin'))) {
         Router::redirect('home.index');
     }
     $this->render('admin/home', 'home.admin.title');
 }
コード例 #4
0
ファイル: UserLoginController.php プロジェクト: summmmit/web
 public function postCreate(Request $request)
 {
     $email = $request->input('email');
     $password = $request->input('password');
     $password_again = $request->input('password_again');
     $inputs = ['email' => $email, 'password' => $password, 'password_again' => $password_again];
     $validator = validator::make($request->all(), ['email' => 'required|unique:users|email', 'password' => 'required|max:16|min:6', 'password_again' => 'required|same:password']);
     if ($validator->fails()) {
         return ApiResponseClass::errorResponse('You Have Some Input Errors', $inputs, $validator->errors());
     }
     $isUrlUser = $request->is('user/*');
     $isUrlAdmin = $request->is('admin/*');
     $isUrlTeacher = $request->is('teacher/*');
     $group_id = null;
     if ($isUrlUser) {
         $group_id = Groups::Student_Group_Id;
     } elseif ($isUrlAdmin) {
         $group_id = Groups::Administrator_Group_ID;
     } elseif ($isUrlTeacher) {
         $group_id = Groups::Teacher_Group_Id_Group_ID;
     }
     DB::beginTransaction();
     try {
         Groups::findorFail($group_id);
         $user = new User();
         $user->email = $email;
         $user->password = Hash::make('password');
         $user->activated = 0;
         $user->email_updated_at = date("Y-m-d h:i:s");
         $user->password_updated_at = date("Y-m-d h:i:s");
         $user->activation_code = str_random(64);
         if (!$user->save()) {
             throw new \ErrorException();
         }
         $user_group = new UsersGroups();
         $user_group->user_id = $user->id;
         $user_group->groups_id = $group_id;
         if (!$user_group->save()) {
             throw new \ErrorException();
         }
         DB::commit();
     } catch (ModelNotFoundException $e) {
         DB::rollback();
         return ApiResponseClass::errorResponse('ModelNotFoundException', $inputs);
     } catch (\ErrorException $e) {
         DB::rollback();
         return ApiResponseClass::errorResponse('ModelNotSavedException', $inputs);
     }
     // Send mail to the user if not the test Shop Id.
     return ApiResponseClass::successResponse($user, $inputs);
 }
コード例 #5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Groups::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, 'office_id' => $this->office_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
コード例 #6
0
ファイル: Groups.php プロジェクト: quenti77/easyhq
 public static function check($type, $auths)
 {
     $id_group = 0;
     if (Session::exists('member')) {
         $member = Session::get('member');
         $id_group = $member['id_group'];
     }
     $auth = self::$authorization[$type]['nothing_right'];
     if ($id_group != 0) {
         $group = Groups::select()->where('id', $id_group)->get();
         if (!empty($group)) {
             $field = "auth_" . $type;
             $auth = $group[0]->{$field};
         }
     }
     $br = new BinaryRight($auth);
     return $br->compare($auths);
 }
コード例 #7
0
 /**
  * Displays a single Members model.
  * @param string $id
  * @return mixed
  */
 public function actionView($id)
 {
     $dataProviderForGroupAss = new ActiveDataProvider(['query' => GroupAssignments::find()]);
     $dataProviderForGroup = new ActiveDataProvider(['query' => Groups::find()]);
     $dataProviderForProject = new ActiveDataProvider(['query' => Projects::find()]);
     try {
         $modelPic = new UploadForm();
         if (Yii::$app->request->isPost) {
             $modelPic->file = UploadedFile::getInstance($modelPic, 'file');
             if ($modelPic->validate() && $modelPic !== null) {
                 $fileName = round(microtime(true) * 1000);
                 $uploadPath = 'uploads/' . $fileName . '.' . $modelPic->file->extension;
                 $modelPic->file->saveAs($uploadPath);
                 //save avatar to user
                 $model = $this->findModel($id);
                 $model->avatar = $uploadPath;
                 $model->save();
             }
         }
     } catch (\Exception $e) {
     }
     return $this->render('view', ['model' => $this->findModel($id), 'modelPic' => $modelPic, 'dataProviderForGroupAss' => $dataProviderForGroupAss, 'dataProviderForGroup' => $dataProviderForGroup, 'dataProviderForProject' => $dataProviderForProject]);
 }
コード例 #8
0
ファイル: UsersForm.php プロジェクト: Abdulhmid/inventory
 public function buildForm()
 {
     $this->add('username', 'text')->add('name', 'text')->add('email', 'text')->add('password', 'password')->add('password_confirmation', 'password')->add('active', 'choice', ['choices' => [1 => 'Active', 0 => 'Not Active'], 'label' => "Status", 'expanded' => true, 'multiple' => false, 'choice_options' => ['wrapper' => ['class' => 'choice-wrapper']]])->add('group_id', 'select', ['attr' => ['class' => 'frm-e form-control'], 'choices' => \App\Models\Groups::lists("group_name", "group_id")->toArray(), 'empty_value' => '- Select Groups-', 'label' => 'Groups'])->add('photo', 'file', ['attr' => ['id' => 'file', 'onchange' => 'readUrl(this)']])->add('upload', 'button', ['label' => '<i class="fa fa-upload"></i> Browse', 'attr' => ['class' => 'form-control btn bg-gray', 'onclick' => 'chooseFile()']]);
 }
コード例 #9
0
ファイル: Beacons.php プロジェクト: DezMonT765/beacon-cms
 public function getGroups()
 {
     return $this->hasMany(Groups::className(), ['id' => 'group_id'])->via('beaconBindings');
 }
コード例 #10
0
ファイル: UserController.php プロジェクト: quenti77/easyhq
 public function register()
 {
     Users::redirectIf(true);
     $nickname = Helper::post('nickname');
     $password = Helper::post('password');
     $confirm = Helper::post('password_confirm');
     $email = Helper::post('email');
     if (empty($nickname) || empty($password) || empty($confirm) || empty($email)) {
         Session::setFlash('danger', '', Translate::get('error.forms.missing.content'));
         Router::redirect('user.signup');
     }
     $errors = [];
     if (strlen($nickname) < 3 || strlen($nickname) > 40) {
         $errors['username'] = Translate::get('register.error.username');
     }
     if (!preg_match('#[a-zA-Z0-9\\_\\.]+#', $nickname)) {
         $errors['username'] = Translate::get('register.error.username');
     }
     if (strlen($password) < 6) {
         $errors['password'] = Translate::get('register.error.password');
     }
     if ($password != $confirm) {
         $errors['password'] = Translate::get('register.error.password_confirm');
     }
     if (!preg_match('/[a-zA-Z0-9\\_\\-\\.]{3,}@[a-zA-Z0-9\\-]{2,}\\.[a-z]{2,6}/', $email)) {
         $errors['email'] = Translate::get('register.error.email');
     }
     if (!empty($errors)) {
         ob_start();
         Translate::getContent('error_fields', ['errors' => $errors]);
         $content = ob_get_clean();
         Session::setFlash('danger', '', $content);
         Router::redirect('user.signup');
     }
     $users = Users::select()->addFields(['id'])->where('nickname', $nickname)->andWhere('mail', $email)->get(0, 1);
     if (!empty($users)) {
         Session::setFlash('danger', '', Translate::get('user.error.register'));
         Router::redirect('user.signup');
     }
     $random = '';
     while ($random == '') {
         $random = Config::randomString(14);
         if (Users::find('user_key', $random)) {
             $random = '';
         }
     }
     $default_group = Groups::find('g_default', 1);
     $user = Users::create();
     $user->id_group = $default_group->id;
     // TODO: Change for default group
     $user->nickname = $nickname;
     $user->password = password_hash($password, PASSWORD_BCRYPT);
     $user->user_key = $random;
     $user->mail = $email;
     $user->mail_check = sha1($user->user_key);
     $user->mail_check_at = BaseModel::now();
     $user->register_at = BaseModel::now();
     $user->connection_at = '0000-00-00 00:00:00';
     $user->save();
     Users::sendMailCheck($user);
     Session::setFlash('success', '', Translate::get('user.success.register'));
     Router::redirect('home.index');
 }
コード例 #11
0
 public function actionGetAlias()
 {
     /**@var $model Groups |AliasBehavior*/
     $value = Yii::$app->request->getQueryParam('value');
     $model = new Groups();
     $model->name = $value;
     $model->getAlias();
     return json_encode(['success' => true, 'alias' => $model->alias]);
 }
コード例 #12
0
ファイル: UserController.php プロジェクト: quenti77/easyhq
 private function checker($name, $ajax = false)
 {
     if (!Groups::check('site', Groups::getAuth('site', $name))) {
         if ($ajax) {
             echo "Vous n'avez pas les droits !";
         } else {
             Router::redirect('home.index');
         }
     }
 }
コード例 #13
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGroup()
 {
     return $this->hasOne(Groups::className(), ['id' => 'group_id']);
 }
コード例 #14
0
 public function actionCategories()
 {
     $return = [];
     $groups = Groups::find()->all();
     foreach ($groups as $group) {
         $return[] = $group->toArray(['id', 'name']);
     }
     return $return;
 }
コード例 #15
0
ファイル: Users.php プロジェクト: DezMonT765/beacon-cms
 public function getGroupsProvider()
 {
     $dataProvider = new ActiveDataProvider(['query' => Groups::find()->joinWith(['users' => function ($query) {
         $query->andFilterWhere(['users.id' => $this->id]);
     }]), 'pagination' => ['pageSize' => 5]]);
     return $dataProvider;
 }
コード例 #16
0
 public function postGoRegister(Request $request)
 {
     $rules = Md\Users::$rulesRegister;
     $validator = \Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     $countUsers = $this->users->whereEmail($request->get('email'))->count();
     if ($countUsers > 0) {
         return redirect()->back()->withInput()->with('messageError', 'Email sudah Terdaftar.');
     }
     $idGroup = Md\Groups::where(\DB::raw('lower(name_content)'), strtolower('member'))->first()->id;
     $input = $request->except(['password_confirmation', 'submit']);
     $input['password'] = bcrypt($request->get('password'));
     $input['username'] = $request->get('email');
     $input['status'] = 0;
     $input['no_telp'] = '-';
     $input['remember_token'] = md5($request->get('email'));
     $input['id_group'] = $idGroup;
     \Mail::send('auth.emails.confirmation', $input, function ($message) use($request) {
         $message->to($request->get('email'), "New Member")->subject('Konfirmasi Pendaftaran');
     });
     $this->users->create($input);
     return redirect()->back()->with('message', 'Pendaftaran Berhasil, Cek Email untuk melakukan konfirmasi.');
 }
コード例 #17
0
ファイル: SchoolController.php プロジェクト: summmmit/web
 public function postValidateSchool(Request $request)
 {
     $registration_code = $request->input('registration_code');
     $group_id = $request->input('group_id');
     $input = ['group_id' => $group_id, 'registration_code' => $registration_code];
     $validator = validator::make($request->all(), ['group_id' => 'required', 'registration_code' => 'required']);
     if ($validator->fails()) {
         return ApiResponseClass::errorResponse('You Have Some Input Errors. Please Try Again!!', $input, $validator->errors());
     } else {
         $code = array();
         $group = Groups::find($group_id);
         if ($group && $group->count() > 0) {
             if ($group_id == Groups::Teacher_Group_Id) {
                 $code_for_teachers = $request->input('code_for_teachers');
                 $school = Schools::where('registration_code', $registration_code)->where('code_for_teachers', $code_for_teachers)->get()->first();
                 $code = array('code_for_teachers' => $code_for_teachers);
             } elseif ($group_id == Groups::Student_Group_Id) {
                 $code_for_students = $request->input('code_for_students');
                 $school = Schools::where('registration_code', $registration_code)->where('code_for_students', $code_for_students)->get()->first();
                 $code = array('code_for_students' => $code_for_students);
             } elseif ($group_id == Groups::Administrator_Group_ID) {
                 $code_for_admin = $request->input('code_for_admin');
                 $school = Schools::where('registration_code', $registration_code)->where('code_for_admin', $code_for_admin)->get()->first();
                 $code = array('code_for_admin' => $code_for_admin);
             }
             $input = array('registration_code' => $registration_code, 'group_id' => $group_id);
             $input = array_merge($input, $code);
             if ($school && $school->count() > 0) {
                 $result = array('school' => $school);
                 $users_registered_to_school = UsersRegisteredToSchool::where('user_id', Auth::user()->id)->where('school_id', $school->id)->get()->first();
                 if ($users_registered_to_school) {
                     return ApiResponseClass::successResponse($result, $input);
                 }
                 $users_registered_to_school = new UsersRegisteredToSchool();
                 $users_registered_to_school->user_id = Auth::user()->id;
                 $users_registered_to_school->school_id = $school->id;
                 $users_registered_to_school->registration_date = date('Y-m-d H:i:s');
                 $users_registered_to_school->save();
                 if ($users_registered_to_school->save()) {
                     return ApiResponseClass::successResponse($result, $input);
                 }
             } else {
                 return ApiResponseClass::errorResponse('School Codes are InValid. Please Try again with Correct Codes!!', $input);
             }
         }
     }
     return ApiResponseClass::errorResponse('Some Problem Occured. Please Try again With Correct Codes!!', $input);
 }
コード例 #18
0
ファイル: GroupController.php プロジェクト: quenti77/easyhq
 private function ajaxSub($id = 0)
 {
     if (!Groups::check('site', Groups::getAuth('site', 'update_full_admin'))) {
         return;
     }
     $group = Groups::findOrCreate('id', $id);
     $get = [];
     foreach (Groups::$authorization as $k => $v) {
         if (!isset($get[$k])) {
             $get[$k] = [];
         }
         $name = "auth_{$k}";
         foreach ($v as $key => $value) {
             $get[$k][$key] = $this->isActive($k, $key, $group->{$name});
         }
         $this->set($k, $get[$k]);
     }
     if ($group->id == 0) {
         $url = Router::url('admin:group.insert');
     } else {
         $url = Router::url('admin:group.update', ['id' => $group->id]);
     }
     $this->set(['group' => $group, 'url' => $url]);
     $this->render('admin/groups_spec');
 }
コード例 #19
0
 public function getEquipmentsFree(Request $request)
 {
     $groups_id = $request->input('groups_id');
     if (isset($groups_id) && !empty($groups_id)) {
         $dataGroup = \App\Models\Groups::find($groups_id);
         if ($dataGroup->customer_id != 0) {
             $newHostPots = new Hostpots();
             $data = $newHostPots->listHotspots($dataGroup->customer_id, 'name');
             foreach ($data as $value => $e) {
                 $dataInt[] = $value;
             }
         }
     }
     $HotsPotsGroups = DB::select("select DISTINCT H.id from hotspots as H " . "inner join hotspots_groups as HG ON H.id=HG.hotspots_id ");
     if (isset($dataInt) && count($dataInt) > 0) {
         if ($HotsPotsGroups) {
             foreach ($HotsPotsGroups as $value) {
                 $idHotspots[] = $value->id;
             }
             $Hostpots = Hostpots::whereNotIn('id', $idHotspots)->whereIn('id', $dataInt)->orWhere('geocode', 0)->lists('mac', 'id');
         } else {
             $Hostpots = Hostpots::whereIn('id', $dataInt)->whereIn('id', $dataInt)->orWhere('geocode', 0)->lists('mac', 'id');
         }
     } else {
         if ($HotsPotsGroups) {
             foreach ($HotsPotsGroups as $value) {
                 $idHotspots[] = $value->id;
             }
             $Hostpots = Hostpots::whereNotIn('id', $idHotspots)->whereGeocode(0)->lists('mac', 'id');
         } else {
             $Hostpots = Hostpots::whereGeocode(0)->lists('mac', 'id');
         }
     }
     return response()->json(array('state' => 1, 'msg' => 'ok', 'data' => $Hostpots));
 }
コード例 #20
0
ファイル: GroupsController.php プロジェクト: josmel/hostpots
 public function getDelete($id)
 {
     $table = null;
     if (!empty($id)) {
         $table = Groups::whereId($id);
         $table->delete();
     }
     return response()->json(array('msg' => 'ok', 'state' => 1, 'data' => null));
 }
コード例 #21
0
 /**
  * Finds the Groups model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Groups the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Groups::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #22
0
 public function getIdGroup($groupId)
 {
     $group = Groups::where('identifiant', '=', $groupId)->first();
     if (!$group) {
         $responseGroup = $this->getGroup($groupId);
         $group = new Groups();
         $group->identifiant = $groupId;
         $group->nom = $responseGroup['name'];
         $group->save();
     }
     return $group->id_Groups;
 }
コード例 #23
0
ファイル: index2.php プロジェクト: cmbis/cmbis
/* @var $searchModel app\models\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'รายชื่อเจ้าหน้าที่ทั้งหมด';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">

    <div class="page-header">
        <h4><?php 
echo Html::encode($this->title);
?>
</h4>
    </div>
    <?php 
//echo $this->render('_search', ['model' => $searchModel]);
$data = ArrayHelper::map(\app\models\Groups::find()->all(), 'name', 'name');
echo Html::dropDownList('groups', null, $data, ['prompt' => '- select group -', 'onchange' => '
    $.pjax.reload({
        url: "' . Url::to(['index2']) . '?UserSearch[group_id]="+$(this).val(),
        container: "#pjax-gridview",
        timeout: 1000,
    });
', 'class' => 'form-control']);
?>
<p>
    <?php 
Pjax::begin(['id' => 'pjax-gridview']);
?>

    <?php 
echo GridView::widget(['id' => 'user-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'containerOptions' => ['style' => 'overflow: auto'], 'pjax' => true, 'exportConfig' => true, 'floatHeader' => true, 'hover' => true, 'panel' => ['type' => GridView::TYPE_PRIMARY, 'heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-book"></i>  ' . $this->title . '</h3>', 'before' => '<div style="padding-top: 7px;"><em>* The table at the right you can pull reports</em></div>'], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-plus"></i>', ['user/create'], ['type' => 'button', 'title' => 'Add ' . $this->title, 'class' => 'btn btn-success']) . ' ' . Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['user/index2'], ['data-pjax' => 0, 'class' => 'btn btn-default', 'title' => 'Reset Grid'])], '{export}'], 'export' => ['fontAwesome' => true], 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'name', 'phone', 'city', ['class' => 'kartik\\grid\\BooleanColumn', 'attribute' => 'status', 'vAlign' => 'middle'], ['class' => 'yii\\grid\\ActionColumn', 'options' => ['style' => 'width:120px;'], 'template' => '<div class="btn-group btn-group-sm" role="group" aria-label="...">{view}{update}{delete}</div>', 'buttons' => ['view' => function ($url, $model, $key) {
コード例 #24
0
ファイル: Groups.php プロジェクト: josmel/hostpots
 public function getGroupsDataTableAll()
 {
     $table = Groups::leftJoin('customers', 'groups.customer_id', '=', 'customers.id')->select(['groups.id', 'groups.customer_id', 'groups.name', 'groups.datecreate', 'customers.name_customer as cliente', DB::raw("(if(groups.flagactive='1','Activo',(if(groups.flagactive='0','Inactivo','-')))) as flagactive")])->where('groups.flagactive', '=', '1')->orderBy('groups.id', 'desc')->get();
     return $table;
 }
コード例 #25
0
ファイル: SiteController.php プロジェクト: wwcao/group8
 /**
  * Help function to search database for the groups
  * that the current logged-in user joined
  * 
  * @return ['myGroups'=>ActiveRecord, 'pagenation'=>Pagination]
  */
 private function searchGroups($keywords)
 {
     //TODO: Check out this functions correctly
     $username = $this->getUser()->username;
     $reserved = ['where', 'interest', 'interests', 'when', 'where'];
     $likecondition = '';
     foreach ($keywords as $x) {
         if ($x == '' || in_array(strtolower($x), $reserved)) {
             continue;
         }
         $likecondition .= "description like '%" . $x . "%' OR ";
     }
     if ($likecondition == '') {
         return ['Groups' => []];
     }
     $likecondition = substr($likecondition, 0, -4);
     $q_joinTbles = "select a.* from (select * from groups where l_user!='{$username}' and status!='c') a LEFT JOIN (select * from groupmembers where m_user!='{$username}') b on a.l_user=b.l_user and a.groupname=b.groupname";
     $queryGroups = Groups::findBySql("select * from ({$q_joinTbles}) c where {$likecondition} order by create_date desc limit 10");
     $queryGroups->select('*');
     $groups = $queryGroups->all();
     return ['Groups' => $groups];
 }
コード例 #26
0
ファイル: Groupmembers.php プロジェクト: wwcao/group8
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGroupname0()
 {
     return $this->hasOne(Groups::className(), ['groupname' => 'groupname', 'l_user' => 'l_user']);
 }