Esempio n. 1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if ($id == null) {
         return null;
     }
     Plot::find($id)->delete();
     return $id;
 }
Esempio n. 2
0
 public function testDestroyPlot()
 {
     $id = \App\Plot::where('name', 'like', 'Test')->first()->id;
     $plotController = new \App\Http\Controllers\plotController();
     $plotController->destroy($id);
     $this->assertNull($plotController->show($id));
     $this->assertNull($plotController->destroy(null));
 }
Esempio n. 3
0
 public function testUpdatePlant()
 {
     $id = \App\Plot::where("name", "like", "TestActivityPlot")->first()->id;
     $plant = array('name' => 'Test plant', 'DOB' => '2015-07-28', 'harvestDay' => 50, 'type' => 'Test2', 'plot_id' => $id);
     $plantId = \App\Plant::where("name", "like", "Test plant")->first()->id;
     $plantController = new \App\Http\Controllers\plantController();
     $request = new \Illuminate\Http\Request();
     $request->replace($plant);
     $plantController->update($plantId, $request);
     $this->seeInDatabase('plant', $plant);
     $this->assertNull($plantController->update(null, $request));
 }
Esempio n. 4
0
 public function getPlots()
 {
     $plots = \App\Plot::where('account_id', $this->currentUser->agent_account_id)->get();
     return view('dashboard.plots', ['plots' => $plots]);
 }