location_update_log_entry.php 774 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * @property int $id
  4. * @property int $location_id
  5. * @property int $user_id
  6. * @property string $modifications_json
  7. * @property string $dts
  8. *
  9. * @method LocationUpdateLogEntry get(int $id)
  10. */
  11. class LocationUpdateLogEntry extends Model {
  12. protected static $table = "location_update_log_entry";
  13. protected static $id_field = "id";
  14. protected static $fillable_fields = ["location_id", "user_id", "modifications_json", "dts"];
  15. // Object methods
  16. /**
  17. * @return Location
  18. */
  19. public function getLocation() {
  20. return Location::get($this->location_id);
  21. }
  22. /**
  23. * @return User
  24. */
  25. public function getUser() {
  26. return User::get($this->user_id);
  27. }
  28. public function getModifications(): array {
  29. return json_decode($this->modifications_json) ?: [];
  30. }
  31. }