Example #1
0
 /**
  * @return \Illuminate\Routing\Route|null|string
  */
 public function ingnoreId()
 {
     // dd('am in request ingnoreId');
     $id = $this->route('drug');
     $name = $this->input('name');
     return Drug::where(compact('id', 'name'))->exists() ? $id : '';
 }
Example #2
0
 /**
  * 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'));
 }
Example #3
0
 /**
  * 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']);
 }
Example #4
0
 /**
  * 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'));
 }