From bec4b03a1758d027cc1d86e2a7c8a16db44c3707 Mon Sep 17 00:00:00 2001 From: James Collins Date: Mon, 17 Apr 2023 13:54:37 +1000 Subject: [PATCH] return a blank string when name attribute --- app/Models/Media.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Models/Media.php b/app/Models/Media.php index a804013..57f3e6d 100644 --- a/app/Models/Media.php +++ b/app/Models/Media.php @@ -206,8 +206,12 @@ class Media extends Model */ public function getUrlAttribute() { - $url = config("filesystems.disks.$this->storage.url"); - return "$url/$this->name"; + if(isset($this->attributes['name'])) { + $url = config("filesystems.disks.$this->storage.url"); + return "$url/$this->name"; + } + + return ''; } /**