Ejemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $metrics = Metric::orderBy('name', 'ASC')->get();
     return View::make('metric.index')->with('metrics', $metrics);
     //return View::make('inventory.metricsList');
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $metrics = Metric::orderBy('name', 'ASC')->lists('name', 'id');
     $commodity = Commodity::find($id);
     //Open the Edit View and pass to it the $patient
     return View::make('commodity.edit')->with('metrics', $metrics)->with('commodity', $commodity);
 }
 /**
  * Tests the update function in the MetricController
  * @depends testStore
  * @param void
  * @return void
  */
 public function testUpdate()
 {
     $this->be(User::first());
     $this->runStore($this->input);
     $metricSaved = Metric::orderBy('id', 'desc')->take(1)->get()->toArray();
     // Update the metric
     $this->runUpdate($this->inputUpdate, $metricSaved[0]['id']);
     $metricUpdated = Metric::orderBy('id', 'desc')->take(1)->get()->toArray();
     $this->assertEquals($metricUpdated[0]['name'], $this->inputUpdate['unit-of-issue']);
     $this->assertEquals($metricUpdated[0]['description'], $this->inputUpdate['description']);
 }