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 store(StoreDocumentRequest $request) { $data = $request->all(); if (!empty($data['zero'])) { \DB::beginTransaction(); try { $data['checked'] = 1; $this->orderRepository->create($data); $document = $this->documentRepository->find($data['document_id']); $pack = $this->packageRepository->find($document->package_id); $pack->qtd = $pack->qtd - 1; $pack->save(); $document->status = 5; $document->save(); \DB::commit(); } catch (\Exception $e) { \DB::rollback(); throw $e; } } else { \DB::beginTransaction(); try { $data['evaluation'] = $this->storeService->evaluation($data); $this->orderRepository->create($data); $document = $this->documentRepository->find($data['document_id']); $pack = $this->packageRepository->find($document->package_id); $pack->qtd = $pack->qtd - 1; $pack->save(); $document->status = $document->status + 1; $document->save(); \DB::commit(); } catch (\Exception $e) { \DB::rollback(); throw $e; } } Session::put('success', 'Corrigida com sucesso'); return redirect()->route('store.doclist', $pack->id); }
public function createImage($id) { $document = $this->documentRepository->find($id); return view('admin.images.create_image', compact('document')); }
public function create($id) { $document = $this->documentRepository->find($id); return view('store.create', compact('document')); }