public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Measure::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
public function run() { DB::table('measures')->delete(); //60lbs -> bushel Measure::create(['unit' => 'bushel', 'abr' => 'bu', 'toPounds' => 60, 'fromPounds' => 1.8E-5]); //1lb -> pound Measure::create(['unit' => 'pound', 'abr' => 'lb', 'toPounds' => 1, 'fromPounds' => 1]); Measure::create(['unit' => 'hundredweight', 'abr' => 'cwt', 'toPounds' => 100, 'fromPounds' => 0.01]); Measure::create(['unit' => 'ton', 'abr' => 'ton', 'toPounds' => 2000, 'fromPounds' => 0.005]); Measure::create(['unit' => 'barrel', 'abr' => 'bbl', 'toPounds' => 162, 'fromPounds' => 0.00357]); //500 lbs -> bale Measure::create(['unit' => 'bale', 'abr' => 'bl', 'toPounds' => 500, 'fromPounds' => 0.002]); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { $row = Request::all(); _MODEL::create($row); Session::flash('message', $this->viewData['whatisit'] . ' created!'); Session::flash('alert-class', 'alert-success'); return redirect($this->controller); }