Update Media model, use cloud filesystem url if enabled instead of cdn_url to easily update S3 media urls

This commit is contained in:
Daniel Supernault 2023-02-03 20:20:51 -07:00
parent b128053d54
commit e6bc57d7b6
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 2 additions and 1 deletions

View file

@ -38,7 +38,7 @@ class Media extends Model
public function url() public function url()
{ {
if($this->cdn_url) { if($this->cdn_url) {
return $this->cdn_url; return Storage::disk(config('filesystems.cloud'))->url($this->media_path);
} }
if($this->remote_media && $this->remote_url) { if($this->remote_media && $this->remote_url) {

View file

@ -82,6 +82,7 @@ return [
], ],
'root' => env('DO_SPACES_ROOT',''), 'root' => env('DO_SPACES_ROOT',''),
'throw' => true, 'throw' => true,
'url' => env('AWS_URL'),
], ],
'backup' => [ 'backup' => [