pixelfed/app/StoryItem.php

41 lines
599 B
PHP
Raw Permalink Normal View History

2019-01-12 07:43:53 +00:00
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
2019-11-11 00:25:52 +00:00
use Pixelfed\Snowflake\HasSnowflakePrimary;
2019-01-12 20:34:10 +00:00
use Storage;
2019-01-12 07:43:53 +00:00
class StoryItem extends Model
{
2019-11-11 00:25:52 +00:00
use HasSnowflakePrimary;
/**
* Indicates if the IDs are auto-incrementing.
*
* @var bool
*/
public $incrementing = false;
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
2023-04-20 04:30:37 +00:00
protected $casts = [
'expires_at' => 'datetime'
];
2019-11-11 00:25:52 +00:00
protected $visible = ['id'];
2019-01-12 07:44:51 +00:00
public function story()
{
return $this->belongsTo(Story::class);
}
2019-01-12 20:34:10 +00:00
public function url()
{
2019-11-11 00:25:52 +00:00
return url(Storage::url($this->media_path));
2019-01-12 20:34:10 +00:00
}
2019-01-12 07:43:53 +00:00
}