public function run() { DB::table('buyers')->delete(); $collection = [['loan_id' => 1, 'buyer' => 'Lansing Louisiana', 'contact' => 'Jason Bourne', 'location' => 'Delhi, LA', 'phone' => '3189991029', 'email' => '*****@*****.**'], ['loan_id' => 1, 'buyer' => 'CropsRUs', 'contact' => 'Drew Brees', 'location' => 'New Orleans, LA', 'phone' => '5043881243', 'email' => '*****@*****.**'], ['loan_id' => 2, 'buyer' => 'Lansing Louisiana', 'contact' => 'Jason Bourne', 'location' => 'Delhi, LA', 'phone' => '3189991029', 'email' => '*****@*****.**']]; foreach ($collection as $record) { Buyer::create($record); } }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Buyer::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }