/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $this->opportunity->find($id)->delete(); return Redirect::route('opportunities.index'); }
public function getOpportunityname() { $q = Input::get('term'); $proj = new Opportunity(); $qproj = new MongoRegex('/' . $q . '/i'); $res = $proj->find(array('$or' => array(array('title' => $qproj), array('opportunityNumber' => $qproj))), array('title', 'opportunityNumber')); $result = array(); foreach ($res as $r) { $result[] = array('id' => $r['_id']->__toString(), 'label' => $r['opportunityNumber'] . ' - ' . $r['title'], 'number' => $r['opportunityNumber'], 'value' => $r['title']); } return Response::json($result); }