public function store(ManagementDocumentRequest $request)
 {
     $data = $request->all();
     if (!empty($data['zero'])) {
         \DB::beginTransaction();
         try {
             $this->orderRepository->create($data);
             $orders = $this->orderRepository->findByField('document_id', $data['document_id'])->all();
             foreach ($orders as $order) {
                 $order->manager = 1;
                 $order->save();
             }
             $document = $this->documentRepository->find($data['document_id']);
             $document->manager = 1;
             $document->manager_evaluation = 5555;
             $document->save();
             \DB::commit();
         } catch (\Exception $e) {
             \DB::rollback();
             throw $e;
         }
     } else {
         \DB::beginTransaction();
         try {
             $data['evaluation'] = $this->managementService->evaluation($data);
             $this->orderRepository->create($data);
             $orders = $this->orderRepository->findByField('document_id', $data['document_id'])->all();
             foreach ($orders as $order) {
                 $order->manager = 1;
                 $order->save();
             }
             $document = $this->documentRepository->find($data['document_id']);
             $document->manager = 1;
             $document->manager_evaluation = $data['evaluation'];
             $document->save();
             \DB::commit();
         } catch (\Exception $e) {
             \DB::rollback();
             throw $e;
         }
     }
     Session::put('success', 'Corrigida com sucesso');
     return redirect()->route('discrepancy.listing');
 }
 public function edit($id)
 {
     $orders = $this->orderRepository->findByField('user_id', $id)->all();
     return view('store.edit', compact('orders'));
 }
 public function update(Request $request, $id)
 {
     $all = $request->all();
     $this->repository->update($all, $id);
     return redirect()->route('admin.orders.index');
 }