bugs fix avatar

This commit is contained in:
Linksehat Staging Server
2023-11-10 15:36:15 +07:00
parent bc73088e4a
commit 6bd48241f0

View File

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