public function refresh()
 {
     $documents = $this->documentRepository->findWhere([['upload', '>', 1]])->all();
     foreach ($documents as $document) {
         $orders = $this->orderRepository->findByField('document_id', $document->id)->all();
         if (!empty($orders)) {
             if (count($orders) != 1) {
                 foreach ($orders as $order) {
                     $avaliacao[] = $order->evaluation;
                 }
                 $notaum = $avaliacao[0];
                 $notadois = $avaliacao[1];
                 //salvando a média
                 $partialevaluation = $notaum + $notadois;
                 $finalevaluation = $partialevaluation / 2;
                 $document->final_evaluation = $finalevaluation;
                 $document->save();
                 //verificando se existe discrepancia
                 $notasomada = $notadois - $notaum;
                 $soma = abs($notasomada);
                 if ($soma > 2.5) {
                     $document->discrepancy = 1;
                     $document->save();
                     echo '<br/>' . $document->id . '- save <br/>';
                 } else {
                     echo '<br/>' . $document->id . '- not save <br/>';
                 }
                 unset($avaliacao);
             }
         }
     }
     return redirect()->route('discrepancy.listing');
 }
 public function doclist($id)
 {
     $documents = $this->documentRepository->findWhere(['package_id' => $id])->all();
     if (empty($documents)) {
         Session::put('success', 'Entre em contato com o administrador para adicionar novo pacote de provas');
         return redirect()->route('store.index');
     }
     return view('store.doclist', compact('documents'));
 }
 public function qtd()
 {
     $counts = $this->document->where('upload', '!=', 0)->count();
     $sexto = $this->document->where('upload', '=', 1)->count();
     $primeira = $this->document->where('upload', '>', 1)->count();
     $orders = $this->order->count();
     $ordersexta = $this->order->where('package_id', '<', 50)->count();
     $orderprimeiro = $this->order->where('package_id', '>', 50)->count();
     $zerosexta = $this->repository->findWhere(['checked' => 1, ['package_id', '<', 50]])->count();
     $zeroprimeira = $this->repository->findWhere(['checked' => 1, ['package_id', '>', 50]])->count();
     $discrepancysexta = $this->documentRepository->findWhere(['discrepancy' => 1, 'project_id' => 2])->count();
     $discrepancyprimeira = $this->documentRepository->findWhere(['discrepancy' => 1, 'project_id' => 3])->count();
     $managersexta = $this->documentRepository->findWhere(['manager' => 1, 'project_id' => 2])->count();
     $managerprimeira = $this->documentRepository->findWhere(['manager' => 1, 'project_id' => 3])->count();
     $managerssexta = $this->repository->findWhere(['manager' => 1, ['package_id', '<', 50]])->count();
     $managersprimeira = $this->repository->findWhere(['manager' => 1, ['package_id', '>', 50]])->count();
     return view('admin.orders.qtd', compact('counts', 'orders', 'zerosexta', 'zeroprimeira', 'discrepancysexta', 'discrepancyprimeira', 'managersexta', 'managerprimeira', 'managerssexta', 'managersprimeira', 'sexto', 'primeira', 'ordersexta', 'orderprimeiro'));
 }
 public function package()
 {
     $package1 = $this->documentRepository->findWhere(['project_id' => '5', 'project_id' => '5'])->all();
     return view('store.package', compact('documents'));
 }