While adding a record we can check a unique key field with unique:<table>,<column> validation but this doesn't seem to work with update, because when some other fields are updated this validation check fails. I found a workaround by comparing the id with a where query, but is there a short/proper way for this?
I suggest you to try this code
$emp_id = Request::get('emp_id', $default); $rules = [ 'emp_id' => 'unique:emp_details,emp_id,NULL,id....'. .. ];
Let me know if you face problem
I found the solution we can pass id along with check to overcome this problem:
Thank you @Cameron and @Pardeeptech :-)
Where/how are you using that snytax? Maybe I've been doing it wrong lol. "unique:<table>,<column>,"$id
Sign in to participate in this thread!