Skip to content

Instantly share code, notes, and snippets.

@devrkd
Last active June 1, 2021 08:04
Show Gist options
  • Save devrkd/25540deae45a9dcddf412a204d2eb719 to your computer and use it in GitHub Desktop.
Save devrkd/25540deae45a9dcddf412a204d2eb719 to your computer and use it in GitHub Desktop.
Laravel tinker example to set password
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