/** * 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']); }
/** * Remove the specified resource from storage (soft delete). * * @param int $id * @return Response */ public function delete($id) { //Soft delete the drug $drug = Drug::find($id); /*$testCategoryInUse = TestType::where('test_category_id', '=', $id)->first(); if (empty($testCategoryInUse)) { // The test category is not in use $testcategory->delete(); } else { // The test category is in use $url = session('SOURCE_URL'); return Redirect::to($url) ->with('message', trans('terms.failure-test-category-in-use')); }*/ // redirect $url = session('SOURCE_URL'); return redirect()->to($url)->with('message', trans('terms.record-successfully-deleted')); }