Generates password hash from password and sets it to the model
public setPassword ( string $password ) | ||
$password | string |
$user = App\Models\User::find(1); $user->setPassword('newpassword'); $user->save();
$user = \Yii::$app->user->identity; $user->setPassword('newpassword'); $user->save();This code retrieves the currently authenticated user, sets their new password using the setPassword method, and saves the updated user object to the database. Package library: Based on the use of the Laravel and Yii2 frameworks in the examples, it can be determined that the package library being used is likely a PHP web application framework, which includes models for common tasks such as user management.
public setPassword ( string $password ) | ||
$password | string |