Files
dredgegram/app/Models/Story.php
T
dredgy d8d4ecbe8a
linter / quality (push) Canceled after 0s
tests / ci (8.3) (push) Canceled after 0s
tests / ci (8.4) (push) Canceled after 0s
tests / ci (8.5) (push) Canceled after 0s
Initial Commit
2026-08-28 21:50:26 +10:00

42 lines
950 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Story extends Model
{
protected $table = 'stories';
protected $keyType = 'string';
public $incrementing = false;
public $timestamps = false;
protected $fillable = [
'id', 'user_id', 'username', 'profile_pic_url', 'code',
'is_video', 'taken_at', 'expiring_at', 'image_url', 'video_url',
'accessibility_caption', 'muted', 'scraped_at',
'viewed_at',
];
protected $casts = [
'is_video' => 'boolean',
'taken_at' => 'integer',
'expiring_at' => 'integer',
'muted' => 'boolean',
'scraped_at' => 'datetime',
'viewed_at' => 'datetime',
];
public function scopeActive($query)
{
return $query->where('expiring_at', '>', now()->timestamp);
}
public function getIsUnreadAttribute(): bool
{
return $this->viewed_at === null;
}
}