You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelfed/app/Models/StoryItem.php

47 lines
1.0 KiB
PHTML

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Storage;
use Pixelfed\Snowflake\HasSnowflakePrimary;
11 months ago
/**
5 days ago
* @property-read \App\Models\Story|null $story
* @method static \Illuminate\Database\Eloquent\Builder<static>|StoryItem newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|StoryItem newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|StoryItem query()
* @mixin \Eloquent
11 months ago
*/
class StoryItem extends Model
{
9 months ago
use HasSnowflakePrimary;
/**
* Indicates if the IDs are auto-incrementing.
*
* @var bool
*/
public $incrementing = false;
protected $visible = ['id'];
7 months ago
protected function casts(): array
{
return [
'expires_at' => 'datetime',
];
}
9 months ago
public function story()
{
return $this->belongsTo(Story::class);
}
public function url()
{
return url(Storage::url($this->media_path));
}
}