mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
39 lines
750 B
PHP
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;
|
|
}
|
|
}
|