public function detailWithAddresses($id)
    {
        $dealer = $this->detail($id);

        if ($dealer->dealersToAddresses) {
            $addressesId = array_map(function($value) {
                return $value['addressId'];
            }, $dealer->dealersToAddresses);

            $addresses = $this->client->addresses()
                ->ids(array_values($addressesId))
                ->all();

            $dealer->addresses = $addresses;
        }

        return $dealer;
    }
public function detailWithAddresses($id)
    {
        $dealer = $this->detail($id);

        if ($dealer->dealersToAddresses) {
            $addressesId = array_map(function($value) {
                return $value['addressId'];
            }, $dealer->dealersToAddresses);

            $addresses = $this->client->addresses()
                ->ids(array_values($addressesId))
                ->all();

            $dealer->addresses = $addresses;
        }

        return $dealer;
    }
public function detailWithAddresses ( $ id ) { $ dealer = $ this -> detail ( $ id ) ; if ( $ dealer -> dealersToAddresses ) { $ addressesId = array_map ( function ( $ value ) { return $ value [ 'addressId' ] ; } , $ dealer -> dealersToAddresses ) ; $ addresses = $ this -> client -> addresses ( ) -> ids ( array_values ( $ addressesId ) ) -> all ( ) ; $ dealer -> addresses = $ addresses ; } return $ dealer ; }
Detail dealer information with additional request to addresses
@param $id
@return Dealer
@throws \GuzzleHttp\Exception\GuzzleException
Detail dealer information with additional request to addresses