location_file.php 669 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Class LocationFile
  4. *
  5. * @property int $id
  6. * @property int $location_id
  7. * @property int $type
  8. * @property string $dts_uploaded
  9. */
  10. class LocationFile extends Model {
  11. protected static $table = "location_file";
  12. protected static $id_field = "id";
  13. protected static $fillable_fields = ["location_id", "type", "dts_uploaded"];
  14. const TYPE_PHOTO = 1;
  15. // Object methods
  16. /**
  17. * @return Location|null
  18. * @throws Exception
  19. */
  20. public function getLocation(): ?Location {
  21. return Location::get($this->location_id);
  22. }
  23. public function getPhotoURL(): string {
  24. return sprintf("/account/locations/%d/photos/%d", $this->location_id, $this->id);
  25. }
  26. }