0
Today I restored my Macbook Pro because I had some incompatibilities with the El Capitan (beta).
During this process I forgot to backup the file .env
of my project, so I could no longer login to the application (on account of APP_KEY
).
Obviously I understand why, but what I couldn’t figure out was how to fix it.
Initially I tried the following:
php artisan key:generate
With that I’ve managed a new APP_KEY
right? So now I need to update all passwords:
Route::get('/', function () {
$users = new Project\DB\User;
$users->update(['password' => Hash::make('newPasswordHere')]);
});
Okay, I’ve updated and I can log in, great, right? No! When I try to update some password by the system (/admin), I can no longer login after that.
Below follows the code of the method update($id)
:
$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 I’m 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, please let me know.