Customizing the Unique validation rule
How would I appropriately customize the Unique validation rule/method that Filament has according to the following?
Here is my
categories
table:
This is what I have so far for the Field:
Will the above work? Or do I need to do something like this or something else?
5 Replies
You can't use $request in livewire requests. Second approach is the way to go
Oh I thought you could based on the documentation here: https://filamentphp.com/docs/3.x/forms/advanced#injecting-dependencies-from-laravels-container
But okay thank you.
Yes, you can inject $request, but it's only going to work on page load (for example in the mount() method of a page), not for Livewire method calls. Livewire doesn't use HTTP requests, you're not doing a POST or a GET or whatever.
And since it’s ajax based the request isn’t actually the url in the browser.
Oh okay