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.
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.
Random Code Snippet Queries: Laravel
- Laravel route parameter
- How to get last month records in Laravel
- SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'user_id'
- Run artisan command to generate key in laravel
- How to call model in blade laravel
- Composer create project laravel/laravel example app
- SQLSTATE[23000]: Integrity constraint violation: 1022 Can't write; duplicate key in table
- How to get column names from table in Laravel
- How to check column value of a record is null or not in laravel
- If condition in foreach loop in laravel
- Setup laravel project with docker
- Where to use whereNotNull eloquent in laravel
- How to get IP address in laravel
- Target class [HomeController] does not exist
- How to get database name in Laravel 9 ?
- How to authenticate admin users in Laravel ?
- Laravel save object to database
- How to check data inserted or deleted in pivot after toggle method
- Show old value while editing the form in Laravel
- How to access the nth object from Laravel collection object ?
- Get content from web URL in laravel
- How to send email in laravel
- Get domain name in laravel
- How to pass variable from controller to model in Laravel
- Laravel get single row by id