Manually register a user in Laravel

前端 未结 5 1070
萌比男神i
萌比男神i 2020-12-07 19:45

Is it possible to manually register a user (with artisan?) rather than via the auth registration page?

I only need a handful of user accounts and wondered if there\'

5条回答
  •  悲&欢浪女
    2020-12-07 20:25

    I think you want to do this once-off, so there is no need for something fancy like creating an Artisan command etc. I would suggest to simply use php artisan tinker (great tool!) and add the following commands per user:

    $user = new App\User();
    $user->password = Hash::make('the-password-of-choice');
    $user->email = 'the-email@example.com';
    $user->name = 'My Name';
    $user->save();
    

提交回复
热议问题