Exemplo n.º 1
0
 public function statistics()
 {
     $users = User::whereHas('trials', function ($query) {
         $query->where('complete', true);
     })->get();
     $totalUsers = $users->count();
     $totalTrials = Trial::whereComplete(true)->count();
     $totalHits = Trial::whereComplete(true)->has('hits', '>', 0)->count();
     $totalSelections = Selection::whereHas('trial', function ($query) {
         $query->where('complete', true);
     })->count();
     $totalChoices = $totalTrials * 5;
     $targets = Target::has('expiredExperiment')->get();
     //        $targets = Target
     return view('pages.statistics')->with(compact('totalUsers', 'totalTrials', 'totalHits', 'totalSelections', 'totalChoices', 'targets'));
 }