Support the ongoing development of Laravel.io →
posted 5 years ago
Validation
Last updated 2 years ago.
0

Can you add this to your model ?

protected $rules = [
    'Column_name' => 'unique:yourmodel',
    ..
];
0

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

0

I found the solution we can pass id along with check to overcome this problem:

"unique:<table>,<column>,"$id

like that.

Thank you @Cameron and @Pardeeptech :-)

0

Where/how are you using that snytax? Maybe I've been doing it wrong lol. "unique:<table>,<column>,"$id

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Goutham Mohadas gmdas Joined 11 Mar 2019

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.