/** * Store a newly created resource in storage. * * @param CreateNoticeRequest $request * @param $group * @return Response */ public function store(CreateNoticeRequest $request, $group) { if ($this->userRepository->isAMemberOf($group, \Auth::user())) { $this->dispatch($this->service->storeNoticeCommand($request, $group)); $this->flash('You have successfully pined a new notice on your group notice board'); return redirect()->back(); } return redirect()->back()->withErrors('You are not a member of this groups, You can not Pin anything here.'); }
/** * @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); }