Livewire Component inside filament Custom page cant use $this->validate()
when i try to use $this->validate it return "array_merge(): Argument #1 must be of type array, null given", when i try to use this livewire component outside custom page it works well. any one know why?
19 Replies
My Filament custom page
My Livewire Component
My blade
it return
We need more information to help you debug your problem. Please click on the top left 'SHARE' button of the error page you're seeing and share the link with us.
Flare
array_merge(): Argument #1 must be of type array, null given - The error occurred at http://kli-new.test/admin/registration/creation-requests/discussion/2
wtf? what are you doing? why aren't you just using filament forms?
custom page is just a livewire component
im building a group chat
so? just use forms
ok ill try, thanks for your suggestion !
I'm saying this personally, as someone who comes here regularly: I think you are often helpful, but I could do with less bitterness in your approach.
when i try to use forms it gives the same error
Don't know how you are using them. Read the docs how to use forms in a livewire component
i literally use it like the docs told
in Blade
@wbzyfishy Wait, you have an array in your rule!!!!
Could you remove the array and keep a string - then check if that's the problem?
#[Rule(['required_without:file'])]
To:
#[Rule('required_without:file')]
Or if that doesn't change things - what are you doing with:
$messages
property
or
public function messages()
Because the flare issue points to those misusedtried it and return the same error
Okay, do you have anything being done with messages?
i dont have
public function messages()
and my $message property i just use it for saving like this
Ahhhhhh
So that's your problem!
public function messages() is a reserved function
you should not use that name. Change this name and everything will work!
ps. This function is now being triggered on validation as it attempts to get the message values (array) from this function. So you are always attempting to also create the message in dataabase 😉
Oh sorry, misunderstood - your public $messages is used for that, not the function! It's also reserved keyword
Your flare error tells you about this:
omg thanks! yea thats the problem! thank for this broo @.modestasv
Heh, no worries! Glad it solved your issue