1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-22 07:42:41 +00:00
pixelfed/app/Models/GroupMedia.php
2024-07-09 23:16:05 -06:00

39 lines
750 B
PHP

<?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;
}
}