Welcome Guest, Not a member yet? Register   Sign In
Unque Validation

(This post was last modified: 02-10-2024, 07:58 AM by titounnes.)

I have a tabel with theese folowing columns
users: id, email
in my table i have an record like this
id : 1
email: [email protected]

in model i create a valdation rule 
'username' => 'required|is_unique[users.email,id,{id}]'

in controller

$data = ['id'=>1, 'email'=>'[email protected]'];
$id = $data->id  
if($model->where('id', $d)->set($data)){
} else {
when I run my code,  have result
The email field must contain a unique value.. 

Can someone help me?

[quote pid="416090" dateline="1707574434"]
in the model the id must be included in the validation rule

Theme © iAndrew 2016 - Forum software by © MyBB