public function closeActionItem($id) { if (Auth::User()->hasRole(['administrator', 'approver'])) { $json['status'] = 1; $json['text'] = "Action item closed"; $json['title'] = 'Complete!'; $json['id'] = $id; $json['closed'] = Carbon::now()->toFormattedDateString(); Actions::where('id', $id)->update(['action_status' => 'Closed', 'closed_on' => Carbon::now()->toDateString()]); } else { $json['status'] = 0; $json['text'] = "You do not have the correct privileges"; $json['title'] = 'Error!'; } return $json; }
public function getOpenActions() { return Actions::where('action_status', 'Open')->get()->count(); }