dimanche 29 mai 2016

Laravel Function Not Updating Database

I am calling the function below

 function makeanote($type,$id){
$note = Notification::where("user_id",Auth::user()->id)->get();
if ($type == "user"){
if($id > $note->pluck("users") ){
$note->users = $id;
$note->save();  
return;
}   
}
return;
           }

Like so: makeanote($type,$id). The calling $type is "user" and the calling $id is "31".

In the database for my current user, the $note value at the users column is currently zero (0).

Therefore I would expect it to update to 31, but it is staying at zero. Am I using pluck() incorrectly?

Thank you.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/25uP4yx
via IFTTT

Aucun commentaire:

Enregistrer un commentaire