示例#1
0
 public function delete(Request $request, $id)
 {
     $b = Usersgroup::find($id);
     $b->name = $request->input('name');
     $b->delete();
     return Redirect('usersgroup');
 }
示例#2
0
文件: Channel.php 项目: nullik/chat
 /**
  * @return array
  * Оформление массива пользователей для отправки клиенту
  */
 public function getFormattedUsers()
 {
     $formattedUsers = [];
     foreach ($this->users as $user) {
         $group = Usersgroup::find()->where(['id' => $user->groupId])->one();
         $formattedUser = [];
         $formattedUser['username'] = $user->username;
         $formattedUser['group'] = $group->name;
         $formattedUsers[] = $formattedUser;
     }
     return $formattedUsers;
 }