StoryItem.php 580 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 $dates = ['expires_at'];
  21. protected $visible = ['id'];
  22. public function story()
  23. {
  24. return $this->belongsTo(Story::class);
  25. }
  26. public function url()
  27. {
  28. return url(Storage::url($this->media_path));
  29. }
  30. }