public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Farmexpense::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
public function run() { DB::table('farmexpenses')->delete(); Farmexpense::create(['crop_year' => 2015, 'loan_id' => 1, 'expense' => 'Equipment', 'cost' => 23196]); Farmexpense::create(['crop_year' => 2015, 'loan_id' => 1, 'expense' => 'Living Expenses', 'cost' => 50000]); }