How to get a particular field value from multidimensional array in laravel

Viewed 2361

I have a variable $cart which stores the details of product. I want to get a particular field from the cart.

dd($cart) show the following result.

Cart {#437 ▼
  +items: array:1 [▼
    "airports_334_64" => array:4 [▼
      "qty" => 1
      "price" => 1600000
      "duration" => 0
      "item" => array:28 [▼
        "id" => 64
        "created_at" => "2017-05-29 10:24:22"
        "updated_at" => "2017-05-29 10:26:51"
        "title" => "Airport ad"
        "price" => "120000"
        "location" => "Airport T3"
        "city" => "Delhi"
        "state" => "Delhi"
        "rank" => "12"
        "landmark" => "abc"
        "description" => "<p>new</p>"
        "image" => "1496053462.jpg"
        "references" => ""
        "status" => "Available"
        "display_options" => null
        "light_option" => null
        "airportnumber" => null
        "discount" => "1"
        "slug" => null
        "reference_mail" => "chingkhei91@gmail.com"
        "airports_id" => "64"
        "area" => "arrival_check_in_hall"
        "displayoption" => "backlit_panel"
        "dimensions" => "7'10"x3'9""
        "optionprice" => "1600000"
        "units" => "8"
        "ad_code" => ""
        "variation_id" => 334
      ]
    ]
  ]
  +totalQty: 1
  +totalPrice: 1600000
}

I want to get the value of reference_mail i.e Cart->items->item->reference_mail

2 Answers
Related