getTaxRates() ); // Find tax rate $user_tax_rate = $rates->first(fn ($item) => $item['country'] === $this->settings->country && $item['active']); return $user_tax_rate ? [$user_tax_rate['id']] : []; } /** * Set user billing info into user settings table */ public function setBilling($billing): UserSettings { $this->settings()->update([ 'address' => $billing['billing_address'], 'city' => $billing['billing_city'], 'country' => $billing['billing_country'], 'name' => $billing['billing_name'], 'phone_number' => $billing['billing_phone_number'], 'postal_code' => $billing['billing_postal_code'], 'state' => $billing['billing_state'], ]); return $this->settings; } }