Ejemplo n.º 1
0
 public function NewgroupAction()
 {
     $newgroup = Request::post('group');
     if (mb_strlen($newgroup) < 5) {
         Site::Message('Название группы не может быть менее 5-и символов');
         $this->GroupAction();
     } elseif (GroupModel::isExists($newgroup, 'name')) {
         $group = GroupModel::GetObj()->where('name = ?', [0 => $newgroup]);
         $group->qty++;
         $group->save();
         $this->company->group_id = $group->id;
         $this->company->save();
         $this->RegionAction();
     } else {
         $group = new GroupModel();
         $group->name = $newgroup;
         $group->qty = '1';
         $group->save();
         $group = GroupModel::GetObj()->where('name = ?', [0 => $newgroup]);
         $this->company->group_id = $group->id;
         $this->company->save();
         $this->RegionAction();
     }
 }