public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Reporttracker::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
public function run() { DB::table('reporttrackers')->delete(); $users = User::where('app', 'staff')->where('role_id', '!=', 20)->get(); $reports = Report::where('is_required', 1)->get(); for ($u = 3; $u < count($users); $u++) { for ($r = 1; $r < count($reports); $r++) { Reporttracker::create(['report_id' => $r, 'user_id' => $u, 'cnt_warned' => rand(0, 15), 'cnt_alerted' => rand(0, 15), 'made_required' => Carbon::now()->subDay(rand(11, 140)), 'last_acknowledged' => Carbon::now()->subDay(rand(0, 10))]); } } }