F
Filamentโ€ข2w ago
nowak

Form Select Relationship error - array_diff(): Argument #2 must be of type array, int given

I am receiving this error from a quite complex ProductResource, which I have attached as a file. And here is the flare share link: https://flareapp.io/share/NPLxGQrP I get this error when I try to create a Product record, filling out the form goes smoothly, but then when clicking the submit button, I get this error. It seems to be related to a select field with a relationship, but I have a few of those, and I don't know exactly what to look for to debug this. Does anyone have any idea of how I can proceed with this?
Flare
array_diff(): Argument #2 must be of type array, int given - The error occurred at https://meinrad_laravel.test/admin/products/create
Solution:
It turned out that a filament update fixed it ๐Ÿ˜ฎโ€๐Ÿ’จ
Jump to solution
2 Replies
nowak
nowakโ€ข2w ago
It seems to happen in the beforeCreate lifecycle,, where I have added this debugging:
protected function beforeCreate(): void
{
\Log::info('In before create - Submitted Data:', request()->all());
}
protected function beforeCreate(): void
{
\Log::info('In before create - Submitted Data:', request()->all());
}
Which gives me this output:
{"_token":"0d2mQOhys4","components":[{"snapshot":"{\"data\":{\"record\":null,\"data\":[{\"name\":\"Apple Lemon\",\"product_type_id\":\"2\",\"attribute_id\":1,\"skus\":[[[{\"sku\":\"J-AL-S\",\"price\":\"4\",\"attributeValues\":1,\"min_portions\":null,\"max_portions\":null},{\"s\":\"arr\"}],[{\"sku\":\"J-AL-L\",\"price\":\"7\",\"attributeValues\":2,\"min_portions\":null,\"max_portions\":null},{\"s\":\"arr\"}]],{\"s\":\"arr\"}],\"description\":null,\"category_id\":\"2\",\"meal_types\":[[\"2\"],{\"s\":\"arr\"}]},{\"s\":\"arr\"}],\"previousUrl\":\"https:\\/\\/meinrad_laravel.test\\/admin\\/products\\/create\",\"mountedActions\":[[],{\"s\":\"arr\"}],\"mountedActionsArguments\":[[],{\"s\":\"arr\"}],\"mountedActionsData\":[[],{\"s\":\"arr\"}],\"defaultAction\":null,\"defaultActionArguments\":null,\"componentFileAttachments\":[[],{\"s\":\"arr\"}],\"mountedFormComponentActions\":[[],{\"s\":\"arr\"}],\"mountedFormComponentActionsArguments\":[[],{\"s\":\"arr\"}],\"mountedFormComponentActionsData\":[[],{\"s\":\"arr\"}],\"mountedFormComponentActionsComponents\":[[],{\"s\":\"arr\"}],\"mountedInfolistActions\":[[],{\"s\":\"arr\"}],\"mountedInfolistActionsData\":[[],{\"s\":\"arr\"}],\"mountedInfolistActionsComponent\":null,\"mountedInfolistActionsInfolist\":null,\"savedDataHash\":\"e72327248734527af8bea011051b600b\"},\"memo\":{\"id\":\"rqk7bhSLLiMjVRR6tvAJ\",\"name\":\"app.filament.resources.product-resource.pages.create-product\",\"path\":\"admin\\/products\\/create\",\"method\":\"GET\",\"children\":[],\"scripts\":[\"2778863608-1\",\"1862246771-0\"],\"assets\":[],\"errors\":[],\"locale\":\"de_CH\"},\"checksum\":\"842bd470ac022e29560c642cbc1ca6f\"}","updates":[],"calls":[{"path":"","method":"create","params":[]}]}]}
{"_token":"0d2mQOhys4","components":[{"snapshot":"{\"data\":{\"record\":null,\"data\":[{\"name\":\"Apple Lemon\",\"product_type_id\":\"2\",\"attribute_id\":1,\"skus\":[[[{\"sku\":\"J-AL-S\",\"price\":\"4\",\"attributeValues\":1,\"min_portions\":null,\"max_portions\":null},{\"s\":\"arr\"}],[{\"sku\":\"J-AL-L\",\"price\":\"7\",\"attributeValues\":2,\"min_portions\":null,\"max_portions\":null},{\"s\":\"arr\"}]],{\"s\":\"arr\"}],\"description\":null,\"category_id\":\"2\",\"meal_types\":[[\"2\"],{\"s\":\"arr\"}]},{\"s\":\"arr\"}],\"previousUrl\":\"https:\\/\\/meinrad_laravel.test\\/admin\\/products\\/create\",\"mountedActions\":[[],{\"s\":\"arr\"}],\"mountedActionsArguments\":[[],{\"s\":\"arr\"}],\"mountedActionsData\":[[],{\"s\":\"arr\"}],\"defaultAction\":null,\"defaultActionArguments\":null,\"componentFileAttachments\":[[],{\"s\":\"arr\"}],\"mountedFormComponentActions\":[[],{\"s\":\"arr\"}],\"mountedFormComponentActionsArguments\":[[],{\"s\":\"arr\"}],\"mountedFormComponentActionsData\":[[],{\"s\":\"arr\"}],\"mountedFormComponentActionsComponents\":[[],{\"s\":\"arr\"}],\"mountedInfolistActions\":[[],{\"s\":\"arr\"}],\"mountedInfolistActionsData\":[[],{\"s\":\"arr\"}],\"mountedInfolistActionsComponent\":null,\"mountedInfolistActionsInfolist\":null,\"savedDataHash\":\"e72327248734527af8bea011051b600b\"},\"memo\":{\"id\":\"rqk7bhSLLiMjVRR6tvAJ\",\"name\":\"app.filament.resources.product-resource.pages.create-product\",\"path\":\"admin\\/products\\/create\",\"method\":\"GET\",\"children\":[],\"scripts\":[\"2778863608-1\",\"1862246771-0\"],\"assets\":[],\"errors\":[],\"locale\":\"de_CH\"},\"checksum\":\"842bd470ac022e29560c642cbc1ca6f\"}","updates":[],"calls":[{"path":"","method":"create","params":[]}]}]}
Solution
nowak
nowakโ€ข2w ago
It turned out that a filament update fixed it ๐Ÿ˜ฎโ€๐Ÿ’จ
Want results from more Discord servers?
Add your server
More Posts