Skip to content
Advertisement

Error: Object of class AppHttpResourcesProductAttributeResource could not be converted to int

I’m using method in my model to mutate a single response to my client

When call product Laravel using this method name by default?

JavaScript

Debugger show this area:

C:xampphtdocs…/…vendorLaravelframeworksrcIlluminateDatabaseEloquentConcernsHasAttributes.php:521

JavaScript

How can I resolve this error?

Advertisement

Answer

in my case i use a reserved method name in my model

for example i define a new attribute() method for my one to many relation that i should choose another name for it

just need to rename your getAttributes to getAttribute method in your model

because this name used by Model Class

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement