Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "id": 1,
- "dhl_purchase_id": 1,
- "type": "import",
- "currency_id": 1,
- "total_amount": "1000.00",
- "payment_method_id": 2,
- "observations": null,
- "date": "2019-01-14 00:00:00",
- "created_at": "2019-01-14 17:24:29",
- "updated_at": "2019-01-16 13:12:45",
- "dhl_purchase": {
- "id": 1,
- "purchase_id": 4291,
- "purchase": {
- "id": 4291,
- "sale_id": 4820,
- "sale": {
- "id": 4820,
- "enterprise_id": 838,
- "enterprise": {
- "id": 838,
- "legal_name": "ENTERPRISE X"
- }
- }
- }
- },
- "currency": {
- "id": 1,
- "name": "$US"
- }
- },
- // ...
- ]
- [
- {
- "id": 1,
- "type": "import",
- "total_amount": "1000.00",
- "date": "14/01/2019",
- "enterprise": {
- "id": 838,
- "legal_name": "ENTERPRISE X"
- }
- "currency": {
- "id": 1,
- "name": "$US"
- }
- },
- // ...
- ]
- $dhl_payments->transform(function ($item, $key) use ($date_format) {
- return [
- 'key' => $key,
- 'id' => $item->id,
- 'type' => $item->type,
- 'date' => $item->date->format($date_format),
- 'total_amount' => $item->total_amount,
- 'currency' => $item->currency,
- 'enterprise' => $item->dhl_purchase->purchase->sale->enterprise, // El error da en esta línea!!!
- ];
- });
- $dhl_payments->transform(function ($item, $key) use ($date_format) {
- return [
- 'key' => $key,
- 'id' => $item->id,
- 'type' => $item->type,
- 'date' => $item->date->format($date_format),
- 'total_amount' => $item->total_amount,
- 'currency' => $item->currency,
- 'enterprise' => $item->dhl_purchase
- ];
- });
- [
- {
- "key": 0,
- "id": 1,
- "type": "import",
- "date": "14/01/2019",
- "total_amount": "1000.00",
- "currency": {
- "id": 1,
- "name": "$US"
- },
- "enterprise": null
- },
- {
- "key": 1,
- "id": 6,
- "type": "import",
- "date": "14/01/2019",
- "total_amount": "100.00",
- "currency": {
- "id": 1,
- "name": "$US"
- },
- "enterprise": null
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement