Attribute Accessors not working after laravel app upgrade

Laravel accessor not working after I upgraded from v8.75 to v11.31

I had this LARAVEL v8.75 App where in the User model I created an Accessor for photo like below

public function getPhotoAttribute($value)
    {
        // Default Photo
        $defaultPhotoUrl = mediaUrl('assets/user.png');

        return !empty($value) && $value != 'undefined' ? (new FileHelper)->getFileUrl($value) : $defaultPhotoUrl;
    }

with the intention of setting the user default image where it’s null, but after my upgrade to v11.31, I noticed empty photos are returned as null instead of with the default image

I went through the documentation and noticed that the syntax was changed. then I upgraded the function to:

     /**
     * Interact with the user's photo.
     */
    protected function photo(): Attribute
    {
        return Attribute::make(
            get: fn (string $value) => (!empty($value) && $value != 'undefined' ? (new FileHelper)->getFileUrl($value) :mediaUrl('assets/user.png')),
        );
    }

but yet no result