public function run() { DB::table('inscrophails')->delete(); $collection = [['loan_id' => 1, 'crop_id' => 1, 'county_id' => 1317, 'inspols_id' => 1, 'amount' => 600, 'premium' => 5], ['loan_id' => 1, 'crop_id' => 2, 'county_id' => 1317, 'inspols_id' => 2, 'amount' => 0, 'premium' => 0]]; foreach ($collection as $record) { Inscrophail::create($record); } }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Inscrophail::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }