jeudi 23 juin 2016

update() with find() in laravel is not working

I am new to laravel, I am facing problem while creating generic update function,

code 1: this is not working

if ($obj->find($primaryKey)->update($data)){
    return TRUE;
}
else
    return FALSE;

code 2: but if i tried this, it is working:

if ($obj->where("candidate_id", $primaryKey)->update($data)){
    return TRUE;
}
else
    return FALSE;

i want code 1 should work

Aucun commentaire:

Enregistrer un commentaire