public function run() { DB::table('commentstatuses')->delete(); Commentstatus::create(['comment_id' => 1, 'recipient_id' => 3, 'status' => 'confirmed']); Commentstatus::create(['comment_id' => 3, 'recipient_id' => 4, 'status' => 'pending']); Commentstatus::create(['comment_id' => 4, 'recipient_id' => 3, 'status' => 'confirmed']); Commentstatus::create(['comment_id' => 7, 'recipient_id' => 3, 'status' => 'pending']); Commentstatus::create(['comment_id' => 10, 'recipient_id' => 3, 'status' => 'pending']); }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Commentstatus::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }