/** * * Funtion for searching through the group records. * @param SearchRequest $request * @return \Illuminate\View\View */ public function search(SearchRequest $request) { $title = 'Join a new group'; $groups = $this->groupRepository->searchedGroups($request->value); $tagline = 'Results(' . $groups->count() . ') for "' . $request->value . '"'; return view('inspina.groups.search', compact('groups', 'title', 'tagline')); }
/** * @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); }