Ejemplo n.º 1
0
 public function store(Request $request)
 {
     $order_data = json_decode($request->get('products'));
     $kiosk_id = $request->get('kiosk_id');
     $participant_id = $request->get('participant');
     $order = $this->orderRepository->create($kiosk_id, $participant_id, $order_data->products);
     return ["order" => $order->id];
 }
Ejemplo n.º 2
0
 public function importExcel()
 {
     $fileInfo = $this->uploadFile(request()->file('file'), 'import');
     $pathToFile = $fileInfo['path'] . '/' . $fileInfo['name'];
     Excel::selectSheets('Sheet1')->load($pathToFile, function ($reader) {
         $rows = $reader->get();
         foreach ($rows as $key => $value) {
             $order = $this->excelForOrder($value, 'monitor');
             // insert into order table
             $newOrder = new OrderRepository(new Order());
             $newOrder->create($order);
         }
     });
     return redirect()->back();
 }
Ejemplo n.º 3
0
 public function importExcel()
 {
     $fileInfo = $this->uploadFile(request()->file('file'), 'import');
     $pathToFile = $fileInfo['path'] . '/' . $fileInfo['name'];
     Excel::selectSheets('Sheet1')->load($pathToFile, function ($reader) {
         $rows = $reader->get();
         foreach ($rows as $key => $value) {
             // b1: insert Order
             $order = $this->excelForOrder($value, 'xmctb');
             $newOrder = new OrderRepository(new Order());
             $t = $newOrder->create($order);
             // b2: insert ship from order
             foreach ($t->phones as $index => $phone) {
                 $input = $this->excelForShip($value, $phone->id);
                 $newShip = new ShipRepository(new Ship());
                 $newShip->create($input);
             }
         }
     });
     return redirect()->back();
 }