StoryItem.php 599 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Pixelfed\Snowflake\HasSnowflakePrimary;
  5. use Storage;
  6. class StoryItem extends Model
  7. {
  8. use HasSnowflakePrimary;
  9. /**
  10. * Indicates if the IDs are auto-incrementing.
  11. *
  12. * @var bool
  13. */
  14. public $incrementing = false;
  15. /**
  16. * The attributes that should be mutated to dates.
  17. *
  18. * @var array
  19. */
  20. protected $casts = [
  21. 'expires_at' => 'datetime'
  22. ];
  23. protected $visible = ['id'];
  24. public function story()
  25. {
  26. return $this->belongsTo(Story::class);
  27. }
  28. public function url()
  29. {
  30. return url(Storage::url($this->media_path));
  31. }
  32. }