Esempio n. 1
0
		</form>
	';
} else {
    $add_group_form = "";
}
if (isset($request_obj->arg[0])) {
    switch ($request_obj->arg[0]) {
        //this checks what you want to effect and what action you want to use on this page
        case "groupAssignment":
            // this for adding or removing some one from a group
            if ($request_obj->account_priv == "Admin" or $request_obj->account_priv == "Officer") {
                //make sure some is allowed to make change
                switch ($request_obj->action) {
                    case "DELETE":
                        // remove from group
                        deleteMemberFromGroup($request_obj);
                        break;
                    case "POST":
                        // add to group
                        addMemberToGroup($request_obj);
                        break;
                }
            }
            break;
        case "groupList":
            // this for adding groups, removeing groups or changeging group name
            if ($request_obj->account_priv == "Admin") {
                switch ($request_obj->action) {
                    case "DELETE":
                        deleteGroup($request_obj);
                        break;
 public function leave($id)
 {
     if (!isFounderOfGroup($id, Auth::id())) {
         deleteMemberFromGroup(Auth::id(), $id);
         flash()->info('You have left the group');
         return redirect('groups/' . $id);
     } else {
         flash()->error('You can not leave the group because you are the founder.');
         return redirect('groups/' . $id);
     }
 }