1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 00:05:29 +00:00
pixelfed/app/Models/GroupMedia.php

40 lines
750 B
PHP
Raw Normal View History

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Storage;
class GroupMedia extends Model
{
use HasFactory;
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'metadata' => 'json',
'processed_at' => 'datetime',
'thumbnail_generated' => 'datetime'
];
}
public function url()
{
if($this->cdn_url) {
return $this->cdn_url;
}
return Storage::url($this->media_path);
}
public function thumbnailUrl()
{
return $this->thumbnail_url;
}
}