Today I restored my Macbook Pro because I had some incompatibilities with the El Capitan (beta) .
During this process, I forgot to back up the .env
file of my project, so I was not able to login to the application (because of APP_KEY
).
Obviously I understand the reason, but what I did not discover was how to solve it.
Initially I tried the following:
php artisan key:generate
With this I generated a new APP_KEY
right? So now I need to update all the passwords:
Route::get('/', function () {
$users = new Project\DB\User;
$users->update(['password' => Hash::make('newPasswordHere')]);
});
Ok, I updated and I can login, great right? Not! When I try to update a password on the system (/ admin), I can not log in after that.
Below is the code for the update($id)
method:
$user = User::getById($id);
$user->role_id = $request->get('role_id');
$user->first_name = $request->get('first_name');
$user->last_name = $request->get('last_name');
$user->email = $request->get('email');
if ($request->has('password')) {
$user->password = Hash::make($request->get('password'));
}
$user->active = $request->get('active');
$user->update();
What am I doing wrong?
My setup
- Macbook Pro - Yosemite
- PHP-FPM -
PHP 5.6.11 (cli) (built: Jul 19 2015 15:15:07)
- Nginx -
nginx version: nginx/1.8.0
If you need more information let me know.