How to automatically set a random string ID in Laravel when a user registers -


i set unique random string (str_random) user id automatically when user registered.

where put code?

'id' => str_random(32);

i thought should go in user.php (model).

you in model:

public static function boot() {     parent::boot();      static::creating(function($table)     {         $table->id = str_random(32);     }); } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -