Address.php 925 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App;
  3. /**
  4. * Class Address
  5. * @property int $id
  6. * @property string $address_1
  7. * @property string $address_2
  8. * @property string $city
  9. * @property string $county
  10. * @property string $postal_code
  11. * @property string $state
  12. * @property string $country
  13. * @property float $latitude
  14. * @property float $longitude
  15. */
  16. class Address extends Model {
  17. protected static $table = "address";
  18. protected static $idField = "id";
  19. protected static $fillableFields = ["address_1", "address_2", "city", "county", "postal_code", "state", "country", "latitude", "longitude"];
  20. // Static methods
  21. public static function getCountryOptions(): array {
  22. return [
  23. "FR" => __("France"),
  24. "DE" => __("Germany"),
  25. "JP" => __("Japan"),
  26. "ES" => __("Spain"),
  27. "GB" => __("United Kingdom"),
  28. ];
  29. }
  30. // Object methods
  31. public function hasGeolocation(): bool {
  32. return isset($this->latitude, $this->longitude);
  33. }
  34. }