public function run() { DB::table('recomments')->delete(); $collection = [['loan_id' => 1, 'comment_id' => 1, 'user_id' => 3, 'body' => "Applicant admitted that he was unprepared for the funds last year and made some foolish purchases early in the loan. He has learned from his mistakes and is receptive to a controlled disbursement."]]; foreach ($collection as $record) { Recomment::create($record); } }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Recomment::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }