public function postTake(PartTakeRequest $request, $workOrderId, $itemId, $stockId)
    {
        try {
            if ($this->processor->postTake($request, $workOrderId, $itemId, $stockId)) {
                flash()->success('Success!', 'Successfully added parts to work order.');

                return redirect()->route('maintenance.work-orders.parts.index', [$workOrderId]);
            } else {
                flash()->error('Error!', 'There was an issue adding parts to this work order. Please try again.');

                return redirect()->route('maintenance.work-orders.parts.stocks.take', [$workOrderId, $itemId, $stockId]);
            }
        } catch (NotEnoughStockException $e) {
            flash()->error('Not Enough Stock', "There isn't enough stock available to take the requested quantity.");

            return redirect()->route('maintenance.work-orders.parts.stocks.take', [$workOrderId, $itemId, $stockId]);
        }
    }
public function postTake(PartTakeRequest $request, $workOrderId, $itemId, $stockId)
    {
        try {
            if ($this->processor->postTake($request, $workOrderId, $itemId, $stockId)) {
                flash()->success('Success!', 'Successfully added parts to work order.');

                return redirect()->route('maintenance.work-orders.parts.index', [$workOrderId]);
            } else {
                flash()->error('Error!', 'There was an issue adding parts to this work order. Please try again.');

                return redirect()->route('maintenance.work-orders.parts.stocks.take', [$workOrderId, $itemId, $stockId]);
            }
        } catch (NotEnoughStockException $e) {
            flash()->error('Not Enough Stock', "There isn't enough stock available to take the requested quantity.");

            return redirect()->route('maintenance.work-orders.parts.stocks.take', [$workOrderId, $itemId, $stockId]);
        }
    }
public function postTake ( PartTakeRequest $ request , $ workOrderId , $ itemId , $ stockId ) { try { if ( $ this -> processor -> postTake ( $ request , $ workOrderId , $ itemId , $ stockId ) ) { flash ( ) -> success ( 'Success!' , 'Successfully added parts to work order.' ) ; return redirect ( ) -> route ( 'maintenance.work-orders.parts.index' , [ $ workOrderId ] ) ; } else { flash ( ) -> error ( 'Error!' , 'There was an issue adding parts to this work order. Please try again.' ) ; return redirect ( ) -> route ( 'maintenance.work-orders.parts.stocks.take' , [ $ workOrderId , $ itemId , $ stockId ] ) ; } } catch ( NotEnoughStockException $ e ) { flash ( ) -> error ( 'Not Enough Stock' , "There isn't enough stock available to take the requested quantity." ) ; return redirect ( ) -> route ( 'maintenance.work-orders.parts.stocks.take' , [ $ workOrderId , $ itemId , $ stockId ] ) ; } }
Processes taking quantity from the stock and
inserting it into the work order.

@param PartTakeRequest $request
@param int|string      $workOrderId
@param int|string      $itemId
@param int|string      $stockId

@return \Illuminate\Http\RedirectResponse
Processes taking quantity from the stock and inserting it into the work order .