public function rejectVolunteer($req, $res) { $org = $this->getOrg($req, $res); if (!is_object($org)) { return $org; } $volunteer = Volunteer::findOne(['where' => ['organization' => $org->id(), 'approval_link' => $req->params('approval_link'), 'role' => Volunteer::ROLE_AWAITING_APPROVAL]]); if (!$volunteer) { return $res->setCode(404); } $volunteer->grantAllPermissions(); $success = $volunteer->delete(); return new View('volunteerApprovedThanks', ['org' => $org, 'title' => $success ? 'Volunteer Denied' : 'Could not deny volunteer', 'success' => $success, 'volunteer' => $volunteer->toArray(), 'name' => $volunteer->relation('uid')->name(true), 'approved' => false]); }