php - Trying to add random strings in columns whenever new row added -
i trying populate 2 columns random strings whenever new user created in laravel
maybe in user model
public function putstringindatabase () { $this->public_key = str_random(40); }
and whenever new row added in users table public_key , private_key columns updated automatically random string
take @ model events. creating
.
for example:
user::creating(function($user) { $this->public_key = str_random(40); $this->private_key = str_random(40); });
Comments
Post a Comment