Complex unique validation rule in Laravel

Laravel provides unique validation rule for check unique value on a given database table.

Ref :



Ex1. Validate unique value in given database table

Ex2. Validate unique value except given ID

In mostly used when update existing record.

Ex3. Gives id column name if primary key of table isn’t ‘id’.

Ex4. Adding additional where clauses for more complex condition

If company has tag list and want to check unique value,

If company has hierarchical folder list and want to check unique value per each node,



You may also like...

Leave a Reply