How to make my method execute a Closure
Hello,
I'm writing a custom function inside my action which should accept a Closure.
Right now this gives the error,
Object of class Closure could not be converted to string
. Looking at other methods I couldn't find a difference, how do you do this?4 Replies
okay that kinda works but my Closure has the
$livewire
argument in itSo you are trying to replicate Filament style? Filament uses
$this->evaluate($closure, [])
for this case. Check whether that's available. Otherwise this is just a wrapper around the Laravel Container . app($closure, [your_arguments])
ah that is it, thank you again!