Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix creating product options in hub #1394

Merged

Conversation

dominik-wbz
Copy link
Contributor

Addressing #1356

After commit c456c78 creating product option in hub throws error

Lunar\Models\ProductOptionValue::getNameAttribute(): Argument #1 ($value) must be of type string, null given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 658

Added test for creating a product option and in ProductOption.php, the function getNameAttribute now accepts null value as an argument to avoid the error.

Copy link

vercel bot commented Dec 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ❌ Failed (Inspect) Dec 19, 2023 6:46pm

@glennjacobs glennjacobs added the bug Something isn't working label Dec 19, 2023
@glennjacobs glennjacobs added this to the v0.7 milestone Dec 19, 2023
@glennjacobs glennjacobs linked an issue Dec 19, 2023 that may be closed by this pull request
@lguichard
Copy link
Contributor

@dominik-wbz

You can also change in ProductOptionValue class & tests :

class ProductOptionValue extends BaseModel implements SpatieHasMedia
...
    public function getNameAttribute(string $value = null): mixed
    {
        return json_decode($value);
    }

@alecritson alecritson merged commit fa8fcaf into lunarphp:0.7 Dec 20, 2023
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

ProductOptionValue model - getNameAttribute type error
4 participants