Beispiel #1
0
 /**
  * @param $group
  * @param Request $request
  * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function updateAdministrator($group, Request $request)
 {
     $user = $this->userRepository->FindByEmail($request->email);
     #Checks whether the user is a member of skoolspace
     if (!$user) {
         return redirect()->back()->withErrors('This is not a member of skoolspace');
     }
     #Checks whether the user is a member of the groups
     if (!$this->repo->isFollowerOf($group, $user)) {
         return redirect()->back()->withErrors('This is not a member of ' . $group->name);
     }
     #Changes the administrator to the new user.
     $group->user_id = $user->id;
     $group->save();
     session()->flash('message', 'You have successfully changed the group administrator to ' . $user->fullName());
     return redirect($group->username);
 }
Beispiel #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param $group
  * @internal param int $id
  * @return Response
  */
 public function destroy($group)
 {
     $this->clientRepository->clientLeave($group, $this->user());
     return redirect('/');
 }