Skip to content
Advertisement

how to implement laravel validation unique in UpdateRequest custom?

I have a unique rule in file UpdateAnimeRequest, and I want to implement a unique rule like this: https://laravel.com/docs/8.x/validation#rule-unique

The problem is if I want to update without changing the title then the unique error appears, how can I prevent this error from appearing when the user doesn’t want to change the title input field?

Here is the contents of my custom request file:

JavaScript

Can someone help me to implement ignore self in my custom request?

Advertisement

Answer

first if you want to ignore self then you must have anime_id to know if this have self or not then rule can be

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement