| 123456789101112131415161718192021222324252627282930313233 |
- <?php
- class Location extends Model {
- protected static $table = "location";
- protected static $id_field = "id";
- protected static $fillable_fields = ["customer_id", "name", "address_1", "address_2", "city", "county", "postal_code", "state", "country", "latitude", "longitude", "dts_verified"];
- protected static $field_map = [
- ];
- // Object methods
- public function getCustomer() {
- return Customer::get($this->customer_id);
- }
- public function getDisplayAddress($fields = ["address_1", "address_2", "city", "county", "postal_code", "state", "country"]) {
- $parts = [];
- foreach($fields as $field) {
- $parts[] = $this->$field;
- }
- return implode(", ", array_filter($parts));
- }
- public function getGeolocation() {
- return [$this->latitude, $this->longitude];
- }
- }
- ?>
|