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

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -