public function run() { DB::table('guarantors')->delete(); Guarantor::create(['loan_id' => 1, 'guarantor' => 'Bo Gwin']); Guarantor::create(['loan_id' => 1, 'guarantor' => 'Sharon Gwin']); Guarantor::create(['loan_id' => 2, 'guarantor' => 'Matthew Murdock']); Guarantor::create(['loan_id' => 2, 'guarantor' => 'Elektra Natchios']); }
public function run() { DB::table('guarantors')->delete(); Guarantor::create(['loan_id' => 1, 'guarantor' => 'Bo Gwin', 'location' => 'Rayville, LA', 'phone' => '3186379928', 'email' => '*****@*****.**']); Guarantor::create(['loan_id' => 1, 'guarantor' => 'Sharon Gwin', 'location' => 'Rayville, LA', 'phone' => '3186379928', 'email' => '*****@*****.**']); Guarantor::create(['loan_id' => 2, 'guarantor' => 'Matthew Murdock', 'location' => 'Boston, MA', 'phone' => '6176379928', 'email' => '*****@*****.**']); Guarantor::create(['loan_id' => 2, 'guarantor' => 'Elektra Natchios', 'location' => 'New York, NY', 'phone' => '2126379928', 'email' => '*****@*****.**']); }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Guarantor::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }