Create users with artisan tinker

Sometimes I need to quickly create a user for admin tasks or to test authentication stuff. Thanks to Auth Essentials - Jeffrey Way's Laracasts for explaining it, this is really easy to do.

Assuming you have your user table already set up, open the tinker command line tool

php artisan tinker

Create a new user (use whatever fields you need e.g. username, email)

$user = new User;
$user->username = 'admin';
$user->name = 'admin';
$user->password = Hash::make('password');
$user->save();

That's it!