(Update) Optimize Many Queries

- reduce load
This commit is contained in:
HDVinnie
2018-10-16 21:27:47 -04:00
parent 8425592072
commit 895bbb66e3
11 changed files with 62 additions and 61 deletions
@@ -20,13 +20,13 @@ class ResetPasswordController extends Controller
protected function resetPassword($user, $password)
{
$validatingGroup = Group::where('slug', '=', 'validating')->first();
$memberGroup = Group::where('slug', '=', 'member')->first();
$validatingGroup = Group::where('slug', '=', 'validating')->pluck('id');
$memberGroup = Group::where('slug', '=', 'member')->pluck('id');
$user->password = bcrypt($password);
$user->remember_token = Str::random(60);
if ($user->group_id === $validatingGroup->id) {
$user->group_id = $memberGroup->id;
if ($user->group_id === $validatingGroup) {
$user->group_id = $memberGroup;
}
$user->active = true;