Пример #1
0
 public function jsonStats()
 {
     $stats = [];
     $stats['people'] = Person::all()->count();
     $stats['projects'] = Project::all()->count();
     $stats['countries'] = Person::distinct('country_id')->count('country_id');
     $stats['orgs'] = Person::distinct('organization_id')->count('organization_id');
     $stats['peopleAppRole'] = $this->getNumbByCategory(new AppRole(), 'name');
     $stats['peopleCountry'] = $this->getNumbByCategory(new Country(), 'name');
     $stats['peopleReviewerType'] = $this->getNumbByCategory(new ReviewerType(), 'name');
     $stats['peopleReviewType'] = $this->getNumbByCategory(new ReviewType(), 'name');
     $stats['peopleCbType'] = $this->getNumbByCategory(new CBType(), 'name');
     $stats['peopleTopic'] = $this->getNumbByCategory(new Topic(), 'name');
     ksort($stats);
     return json_encode($stats, JSON_PRETTY_PRINT);
 }
Пример #2
0
 /**
  * Count number of unique vaules by column.
  *
  * @param
  *
  * @return Collection
  */
 public function countUnique($field)
 {
     return Person::distinct($field)->count($field);
 }