app/Http/Controllers/PurchaseRequestController.php
/**
     * Update the specified resource in storage.
     *
     * @param Request $request
     * @param PurchaseRequest $purchaseRequest
     * @return JsonResponse
     */
Update the specified resource in storage.
@param Request $request
@param PurchaseRequest $purchaseRequest
@return JsonResponse
Update the specified resource in storage . @param Request $request @param PurchaseRequest $purchaseRequest @return JsonResponse
public function update(Request $request, PurchaseRequest $purchaseRequest)
    {
        $purchase['isActive'] = $request->isActive;
        if ($request->isActive) {
            $purchaseRequest->update($purchase);
        }
        $purchaseRequestLog = PurchaseRequestLog::query()
            ->find($request->purchase_request_log_id);
        $data['quantity'] = $request->quantity ? $request->quantity : $purchaseRequestLog->quantity;
        $data['unit_id'] = $request->unit_id ? $request->unit_id :  $purchaseRequestLog->unit_id;
        if ($purchaseRequestLog->update($data)) {
            return Helper::response_with_data($purchaseRequest->load('purchase_request_log'), false);
        }
        return Helper::response_with_data(null, true);
    }
public function update ( Request $ request , PurchaseRequest $ purchaseRequest ) { $ purchase [ 'isActive' ] = $ request -> isActive ; if ( $ request -> isActive ) { $ purchaseRequest -> update ( $ purchase ) ; } $ purchaseRequestLog = PurchaseRequestLog :: query ( ) -> find ( $ request -> purchase_request_log_id ) ; $ data [ 'quantity' ] = $ request -> quantity ? $ request -> quantity : $ purchaseRequestLog -> quantity ; $ data [ 'unit_id' ] = $ request -> unit_id ? $ request -> unit_id : $ purchaseRequestLog -> unit_id ; if ( $ purchaseRequestLog -> update ( $ data ) ) { return Helper :: response_with_data ( $ purchaseRequest -> load ( 'purchase_request_log' ) , false ) ; } return Helper :: response_with_data ( null , true ) ; }
Update the specified resource in storage.
Update the specified resource in storage .