/** * 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('drug.index', compact('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('organism.edit', compact('organism', 'drugs')); }
/** * Tests the update function in the DrugController * @param void * @return void */ public function testUpdate() { $this->withoutMiddleware(); $this->call('POST', '/drug', $this->drugData); // Update the Drug $drugStored = Drug::orderBy('id', 'desc')->first(); $this->withoutMiddleware(); $this->call('PUT', '/drug/1', $this->drugUpdate); // $drugUpdated = Drug::find($drugStored->id); $drugUpdated = Drug::find('1'); $this->assertEquals($drugUpdated->name, $this->drugUpdate['name']); $this->assertEquals($drugUpdated->description, $this->drugUpdate['description']); }