Laravel 5 validation unique – except dynamic id

I won’t go into details about how great validation in Laravel is and how to do it.

I was just searching how to set a slug field as unique – except when doing an update on a field that has this unique instance of our slug.

There is an example in docs, but only for a static ID.

I’m not sure if my approach is correct but it gets the job done 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Please prove me that you are not spamer :) * Time limit is exhausted. Please reload CAPTCHA.