public function shippingRate() { if ($this->country === null) { return 0; } else { return $this->country->shipping_rate; } }