public function run() { DB::table('references')->delete(); $collection = [['loan_id' => 1, 'creditor' => 'Delhi Credit and Loan', 'city_state' => 'Delhi, LA', 'contact' => 'Joan London', 'phone' => '3183455294', 'email' => '*****@*****.**'], ['loan_id' => 1, 'creditor' => 'Rayville Credit and Loan', 'city_state' => 'Rayville, LA', 'contact' => 'Jack Frost', 'phone' => '3189820304', 'email' => '*****@*****.**'], ['loan_id' => 2, 'creditor' => 'Rayville Credit and Loan', 'city_state' => 'Rayville, LA', 'contact' => 'Jack Frost', 'phone' => '3189820304', 'email' => '*****@*****.**']]; foreach ($collection as $record) { Reference::create($record); } }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Reference::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }