public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Loandistributor::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
public function run() { DB::table('loandistributors')->delete(); Loandistributor::create(['loan_id' => 1, 'distributor_id' => 6, 'contact' => 'Marie Osmond', 'phone' => '3189991212', 'email' => '*****@*****.**']); Loandistributor::create(['loan_id' => 2, 'distributor_id' => 6, 'contact' => 'Donnie Trump', 'phone' => '3189991232', 'email' => '*****@*****.**']); }