Support the ongoing development of →
Database Eloquent Validation
Last updated 2 years ago.

Laravel 5.4 - Validation - Unique Rule

Laravel 5.2 - Validation - Unique Rule <- similar formatting to what you are using

its in the validation docs for the unique rule - "Forcing A Unique Rule To Ignore A Given ID"


Thanks for answer! If found that similar rule works ok when I need "=" in sql statement


and I have sql :

select count(*) as aggregate from `jsn_department` where `name` = 'Department_111222' and `department_id` = '1'

But I failed to set condition with "!=" : Setting rule as :


I got error:

Unknown column 'department_id!=' in 'where clause' (SQL: select count(*) as aggregate from `jsn_department` where `name` = Department_111222 and `department_id!=` = 1)

As I see "department_id!=" is wrapped with "`" char and "=" is set anyway...

Which is the right syntax ?

Last updated 7 years ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.