public function adminUpdate($id) { $user = User::findWithPermission($id); $madeTrusted = false; if (\Input::has('trusted')) { if (!$user->trusted && \Input::get('trusted')) { //User has been made a trusted member $madeTrusted = true; } $user->trusted = \Input::get('trusted'); } if (\Input::has('key_holder')) { $user->key_holder = \Input::get('key_holder'); } if (\Input::has('induction_completed')) { $user->induction_completed = \Input::get('induction_completed'); } if (\Input::has('profile_photo_on_wall')) { $profileData = $user->profile()->first(); $profileData->profile_photo_on_wall = \Input::get('profile_photo_on_wall'); $profileData->save(); } if (\Input::has('photo_approved')) { $profile = $user->profile()->first(); if (\Input::get('photo_approved')) { $this->userImage->approveNewImage($user->hash); $profile->update(['new_profile_photo' => false, 'profile_photo' => true]); } else { $profile->update(['new_profile_photo' => false]); event(new MemberPhotoWasDeclined($user)); } } $user->save(); if (\Input::has('approve_new_address')) { if (\Input::get('approve_new_address') == 'Approve') { $this->addressRepository->approvePendingMemberAddress($id); } elseif (\Input::get('approve_new_address') == 'Decline') { $this->addressRepository->declinePendingMemberAddress($id); } } if ($madeTrusted) { $message = 'You have been made a trusted member at Build Brighton'; $notificationHash = 'trusted_status'; Notification::logNew($user->id, $message, 'trusted_status', $notificationHash); event(new MemberGivenTrustedStatus($user)); } if (\Request::wantsJson()) { return \Response::json('Updated', 200); } else { \Notification::success('Details Updated'); return \Redirect::route('account.show', [$user->id]); } }