/** * 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('organism.index')->with('organisms', $organisms); }
/** * Tests the update function in the OrganismController * @param void * @return void */ public function testUpdate() { $this->withoutMiddleware(); $this->call('POST', '/organism', $this->organismData); $organismStored = Organism::orderBy('id', 'desc')->first(); $this->withoutMiddleware(); $this->call('PUT', '/organism/' . $organismStored->id, $this->organismDataUpdate); $organismSavedUpdated = Organism::find($organismStored->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->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 = $testtype->testCategory->id; $testcategories = TestCategory::lists('name', 'id'); $organisms = Organism::orderBy('name')->get(); //Open the Edit View and pass to it the $testtype return view('testtype.edit', compact('testtype', 'testcategories', 'testcategory', 'measures', 'measuretype', 'specimentypes', 'organisms')); }