/** * Remove project member. * * @param $id User ID * * @return \Avalon\Http\RedirectResponse|\Avalon\Http\Response */ public function destroyAction($id) { $userRole = UserRole::select()->where('project_id = ?')->andWhere('user_id = ?')->setParameter(0, $this->currentProject['id'])->setParameter(1, $id)->fetch(); if (!$userRole) { return $this->show404(); } else { $userRole->delete(); return $this->redirectTo('project_settings_members'); } }
/** * Remove project member. * * @param $id User ID * * @return \Avalon\Http\RedirectResponse|\Avalon\Http\Response */ public function destroyAction($id) { $userRole = UserRole::select()->where('project_id = ?')->andWhere('user_id = ?')->setParameter(0, $this->currentProject['id'])->setParameter(1, $id)->fetch(); if (!$userRole) { return $this->show404(); } $userRole->delete(); return $this->respondTo(function ($format) { if ($format == 'json') { return $this->jsonResponse(['deleted' => true]); } else { return $this->redirectTo('project_settings_members'); } }); }