jeudi 7 janvier 2016

How to Combine Two Transformer Json Responses under a Single Variable in Laravel 5.1

My Code:

$single_product=ProductModel::where('deletestatus','=',0)->where('id','=',$id)->get();
$product_information = $this->response->withCollection($single_product, new ProductTransformer);
$review_product = ProductReviewModel::where('id','=',$id)->get();
$review_product_information = $this->response->withCollection($review_product, new ProductReviewTransformer);
$resource = collect($product_information, $review_product_information);
return $resource; 

We are using Two Transformers in our Project namely ProductTransformer and ProductReviewTransformer. We need to Combine both the Json Output Under a Single Variable Called $resource. But we are Getting the Output as I have Provided in my Screenshot. http://ift.tt/1kOtYFt

Provide us with a Solution to Do this.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire