How to access attribute from object in Laravel

Viewed 79

I am using Elasticsearch to get data.

$addresses = Address::multiMatchSearch()
    ->fields(['full_address'])
    ->query("nsw")
    ->fuzziness('AUTO')
    ->paginate();

foreach ($addresses as $address) {
    dd($address);
}

I am receiving the object in the following format. How can access city attribute from object ? As you can see that I dd inside a loop. This will be the first record.

ElasticScoutDriverPlus\QueryMatch {#781 ▼
  -lazyModelFactory: ElasticScoutDriverPlus\Factories\LazyModelFactory {#779 ▶}
  -hit: ElasticAdapter\Search\Hit {#710 ▼
    -hit: array:5 [▼
      "_index" => "addresses"
      "_type" => "_doc"
      "_score" => 5.3255396
      "_source" => array:25 [▼
        "id" => 228606
        "company_name" => "Lucy Segal"
        "customer_name" => null
        "street_address" => "19 Russell Road"
        "suburb" => "New Lambton"
        "city" => null
        "postcode" => 2305
        "state" => "NSW"
        "telephone" => "400473458"
       
        "status" => 1
        "geocoded" => 1
        "country" => "Australia"
        "full_address" => "Lucy Segal, 19 Russell Road, New Lambton, NSW, 2305"
     
      ]
    ]
  }
}
0 Answers
Related