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
required|unique:department,name,null,department_id,department_id,1
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 :
required|unique:department,name,null,department_id,department_id!=,1
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 ?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community