Skip to content

Instantly share code, notes, and snippets.

@msurguy
Created March 27, 2013 01:24
Show Gist options
  • Save msurguy/5250811 to your computer and use it in GitHub Desktop.
Save msurguy/5250811 to your computer and use it in GitHub Desktop.
Reset user's password in Laravel 3 through artisan command . Put this file into application/tasks Usage from command line : php artisan resetpass 1 nEwP@SSwOrd Where 1 is user's id and "nEwP@SSwOrd" is the new password
<?php
class Resetpass_Task {
public function run($arguments)
{
$userid = $arguments[0];
$newpass = $arguments[1];
$user = User::find($arguments[0]);
if($user){
$user->password = Hash::make($newpass);
if ($user->save()){
echo (' User '.$user->username.' updated');
} else {
echo (' User '.$user->username.' NOT updated');
}
} else {
echo (' User does not exist');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment