diff --git a/app/Models/User.php b/app/Models/User.php index ed117a73..9e0ac57f 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -33,6 +33,7 @@ class User extends Authenticatable 'password', 'code', 'status', + 'unsubscribe_token' ]; @@ -100,4 +101,11 @@ class User extends Authenticatable return $this->belongsToMany(Prospecto::class); } + protected static function booted() + { + static::creating(function ($user) { + $user->unsubscribe_token ??= \Illuminate\Support\Str::uuid(); + }); + } + }