Skip to content
Advertisement

Manually register a user in Laravel

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’s a way to create these without having to set up the registration controllers and views.

Advertisement

Answer

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 AppUser();
$user->password = Hash::make('the-password-of-choice');
$user->email = 'the-email@example.com';
$user->name = 'My Name';
$user->save();
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement