diff --git a/app/Models/Member.php b/app/Models/Member.php index 53ccd9fd..7d0c0ff7 100644 --- a/app/Models/Member.php +++ b/app/Models/Member.php @@ -250,10 +250,16 @@ class Member extends Model protected function corporateLogo(): Attribute { $avatar = File::where(['type' => 'avatar', 'fileable_id' => $this->currentPolicy->corporate->id])->orderBy('id', 'desc')->get()->first(); - $path = $_ENV['LMS_APP_STORAGE'] . $avatar->path; - return Attribute::make( - get: fn () => $avatar ? $path : null - ); + if ($avatar){ + $path = $_ENV['LMS_APP_STORAGE'] . $avatar->path ? $avatar->path :''; + return Attribute::make( + get: fn () => $avatar ? $path : null + ); + } else { + return Attribute::make( + get: fn () => null + ); + } } /* -------------------------------------------------------------------------- */ }