Last active
November 19, 2020 17:11
-
-
Save SalvadorP/70b9ef73e048d0574482 to your computer and use it in GitHub Desktop.
Laravel 5.1 how to create a user using artisan tinker and the standard user model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php artisan tinker | |
$user = new App\User; | |
$user->name="Admin"; | |
$user->email="[email protected]"; | |
$user->password=bcrypt('1234'); | |
$user->save(); |
But and the Role?
@soaresdiogo This is adding new User in a basic way, so you can add Role, ... also you can make it complicated as much as you can
Thank!! Very helped me.
Thanks for the comments and the stars!
I'm happy that this helped someone :)
can some one help. when "$user = new App/User;" i get this "Undefined index: App/User in C:/xampp/htdocs/laravel-vue/vendor/laravel/framework/src/Illu
minate/Database/Eloquent/Model.php "
but the data still save to the user table. can someone explain this?
thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is very Good :-)