Last active
June 1, 2021 08:04
-
-
Save devrkd/25540deae45a9dcddf412a204d2eb719 to your computer and use it in GitHub Desktop.
Laravel tinker example to set password
This file contains 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
Psy Shell v0.9.9 (PHP 7.2.16 — cli) by Justin Hileman | |
>>> $u = new App\User; | |
=> App\User {#2930} | |
>>> $u->all() | |
=> Illuminate\Database\Eloquent\Collection {#2938 | |
all: [ | |
App\User {#2939 | |
id: 1, | |
name: "ramesh", | |
email: "example@info.com", | |
email_verified_at: "2019-06-30 17:56:57", | |
created_at: "2019-06-30 17:56:57", | |
updated_at: "2019-06-30 17:56:57", | |
}, | |
], | |
} | |
>>> $u = $u->find(1) | |
=> App\User {#2936 | |
id: 1, | |
name: "ramesh", | |
email: "example@info.com", | |
email_verified_at: "2019-06-30 17:56:57", | |
created_at: "2019-06-30 17:56:57", | |
updated_at: "2019-06-30 17:56:57", | |
} | |
>>> $u->password = bcrypt('1234567890') | |
=> "$2y$10$VgwA8tgAIzsgrX6lCFlNWOXd27D6lXx6YwIzcJvqJxrVx1whQnjoa" | |
>>> $u->save() | |
=> true | |
>>> exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment