mercredi 27 décembre 2017

Laravel updating column with relation

I have the model with activation tokens:

class ActivationToken extends Model
{
    public function user() : BelongsTo
    {
        return $this->belongsTo(User::class);
    }
}

in Activation controller, i have the $token object. So, I can check with the user is attached to this token: $token->user; the question is how can I update an is_active column in my user table?

$token->user->is_active = true; How can i save it?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire