public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Viewoption::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
public function run() { DB::table('viewoptions')->delete(); Viewoption::create(['user_id' => 1]); Viewoption::create(['user_id' => 2]); Viewoption::create(['user_id' => 3, 'voCommitDistributor' => 1, 'voCommitArm' => 1, 'voAcresTotal' => 1, 'voBalanceDue' => 1]); Viewoption::create(['user_id' => 4, 'voCommitDistributor' => 1, 'voCommitArm' => 1, 'voAcresTotal' => 1, 'voBalanceDue' => 1]); $users = DB::table('users')->count(); for ($c = 5; $c < $users + 1; $c++) { Viewoption::create(['user_id' => $c]); } }