location_note.php 868 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Class LocationNote
  4. * @property int $id
  5. * @property int $location_id
  6. * @property int $user_id
  7. * @property string $content
  8. * @property string $dts_created
  9. * @property string $dts_updated
  10. * @property string $dts_deleted
  11. */
  12. class LocationNote extends Model {
  13. protected static $table = "location_note";
  14. protected static $id_field = "id";
  15. protected static $fillable_fields = ["location_id", "user_id", "content", "dts_created", "dts_updated", "dts_deleted"];
  16. public function getUser(): User {
  17. return User::get($this->user_id);
  18. }
  19. public function getLocation(): Location {
  20. return Location::get($this->location_id);
  21. }
  22. public function getDateTimeCreated(): DateTime {
  23. return new DateTime($this->dts_created, new DateTimeZone("UTC"));
  24. }
  25. public function getContentHTML(): string {
  26. return nl2br(htmlspecialchars($this->content));
  27. }
  28. }