/** * Display a listing of the resource. * * @return Response */ public function index() { //List all drugs $drugs = Drug::orderBy('name', 'ASC')->get(); //Load the view and pass the drugs return View::make('drug.index')->with('drugs', $drugs); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $drugs = Drug::orderBy('name')->get(); //Get the organism $organism = Organism::find($id); //Open the Edit View and pass to it the $organism return View::make('organism.edit')->with('organism', $organism)->with('drugs', $drugs); }
/** * Tests the update function in the DrugController * @param void * @return void */ public function testUpdate() { // Update the Drug Input::replace($this->drugData); $drug = new DrugController(); $drug->store(); $drugStored = Drug::orderBy('id', 'desc')->take(1)->get()->toArray(); Input::replace($this->drugUpdate); $drug->update($drugStored[0]['id']); $drugSaved = Drug::find($drugStored[0]['id']); $this->assertEquals($drugSaved->name, $this->drugUpdate['name']); $this->assertEquals($drugSaved->description, $this->drugUpdate['description']); }