/** * Display a listing of the resource. * * @return Response */ public function index() { //List all organisms $organisms = Organism::orderBy('name', 'ASC')->get(); //Load the view and pass the organisms return View::make('organism.index')->with('organisms', $organisms); }
/** * Tests the update function in the OrganismController * @param void * @return void */ public function testUpdate() { Input::replace($this->organismData); $organism = new OrganismController(); $organism->store(); $organismStored = Organism::orderBy('id', 'desc')->take(1)->get()->toArray(); Input::replace($this->organismDataUpdate); $organism->update($organismStored[0]['id']); $organismSavedUpdated = Organism::find($organismStored[0]['id']); $this->assertEquals($organismSavedUpdated->name, $this->organismDataUpdate['name']); $this->assertEquals($organismSavedUpdated->description, $this->organismDataUpdate['description']); //Getting the drugs related to the organism /*$organismDrugUpdated = Organism::find($organismStored[0]['id'])->drugs->toArray(); $this->assertEquals(12, $this->organismDataUpdate['drugs'][0]);*/ }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { //Get the testtype $testtype = TestType::find($id); $measures = Measure::all(); $measuretype = MeasureType::all()->sortBy('id'); $specimentypes = SpecimenType::orderBy('name')->get(); $testcategory = TestCategory::all(); $organisms = Organism::orderBy('name')->get(); //Open the Edit View and pass to it the $testtype return View::make('testtype.edit')->with('testtype', $testtype)->with('testcategory', $testcategory)->with('measures', $measures)->with('measuretype', $measuretype)->with('specimentypes', $specimentypes)->with('organisms', $organisms); }