app/Http/Controllers/PurchaseRequestController.php
/**
     * Remove the specified resource from storage.
     *
     * @param PurchaseRequest $purchaseRequest
     * @return JsonResponse
     */
Remove the specified resource from storage.
Remove the specified resource from storage .
public function destroy(PurchaseRequest $purchaseRequest)
    {
        $purchase_request_id = $purchaseRequest->id;
        $purchaseRequestLog = PurchaseRequestLog::query()
            ->where('purchase_request_id', '=', $purchaseRequest->id)
            ->get();
        if ($purchaseRequest->delete())
        {
            foreach ($purchaseRequestLog as $value){
                $value->delete();
            }
            return Helper::response_with_data(null, false);
        }
        return Helper::response_with_data(null, true);
    }
public function destroy ( PurchaseRequest $ purchaseRequest ) { $ purchase_request_id = $ purchaseRequest -> id ; $ purchaseRequestLog = PurchaseRequestLog :: query ( ) -> where ( 'purchase_request_id' , '=' , $ purchaseRequest -> id ) -> get ( ) ; if ( $ purchaseRequest -> delete ( ) ) { foreach ( $ purchaseRequestLog as $ value ) { $ value -> delete ( ) ; } return Helper :: response_with_data ( null , false ) ; } return Helper :: response_with_data ( null , true ) ; }
Remove the specified resource from storage.
Remove the specified resource from storage .