F
Filament2y ago
Abi

Utility Injection on action method not working

does utility injection work on Action's action method? when I try Action::icon('some-icon')->action(function (Livewire $livewire, $state) { I get the following error
Argument #1 ($livewire) must be of type Livewire\Livewire, Edit{Resource}Page given
called in vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
Argument #1 ($livewire) must be of type Livewire\Livewire, Edit{Resource}Page given
called in vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
Solution:
Should be ‘Component’ not ‘Livewire’. You’re using the wrong class.
Jump to solution
6 Replies
Solution
awcodes
awcodes2y ago
Should be ‘Component’ not ‘Livewire’. You’re using the wrong class.
Abi
AbiOP2y ago
i was trying to access the Livewire instance i see the import on that example, thank you
awcodes
awcodes2y ago
You are doing it right you’re just injecting the wrong class. 🙂
Abi
AbiOP2y ago
thank you. Would you mind if I DM you? Got to get some opinion on something I have been working on.
awcodes
awcodes2y ago
Sure. Fair warning my brain doesn’t want to work today. Lol.

Did you find this page helpful?