Create user in Laravel using tinker

Created at 19-Mar-2024 , By samar

In this article we will learn about how to create a user using tinker.

First open terminal and move to your project directory using cd command

cd projectname

Enter command in terminal to run tinker (command line)

php artisan tinker

Create user

$user = new App\Models\User();
$user->name = 'John Doe';
$user->email = 'john@example.com';
$user->password = bcrypt('password');
$user->save();

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.