vendredi 4 août 2017

can't overwrite laravel elequent output's id field

I can't overwrite the $user->id i the following code :

$followers_list = follow::where('followed_id',$userId['userId'])
            ->get();   

        foreach($followers_list as $follower)
        {
           $user = myuser::find($follower->follower_id);           
           $user->id = Crypt::encrypt(['id'=> $user->id]);               
           echo $user->id; //it's zero for all users
           array_push($followers,$user);               
        }

is it a rule or something in laravel eloquent to prevent such type conversions(integer to string)?

how can I replace the id's integer value with its encrypted string?

any help?



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

Aucun commentaire:

Enregistrer un commentaire