Exemplo n.º 1
0
 /**
  * Update user's profile.
  *
  * @param User $user
  * @param Request $request
  * @return User
  */
 public function updateUser(User $user, Request $request)
 {
     if ($request->email != $user->email) {
         $user->email = $request->email;
         $user->token = str_random(30);
         $user->is_verified = false;
     }
     if ($request->avatar) {
         AvatarController::deleteAvatarFile($user->avatar);
         $user->avatar = AvatarController::makeAvatarFromUrl($request->avatar);
     }
     if ($request->password) {
         $user->password = bcrypt($request->password);
     }
     $user->name = $request->name;
     $user->nickname = $request->nickname;
     $user->save();
     return $user;
 }
 /**
  * Verify user's email address.
  *
  * @param $token
  * @return \Illuminate\Http\RedirectResponse
  */
 public function verifyEmail($token)
 {
     $user = User::whereToken($token)->first();
     if ($user) {
         $user->verifyEmail();
         flash()->overlay(trans('messages.email_verified.title'), trans('messages.email_verified.success', ['email' => $user->email]), 'success');
         if (!$this->guard()->check()) {
             return redirect(route('login'));
         }
     } else {
         flash()->overlay(trans('messages.error'), trans('messages.email_verified.error'), 'error');
     }
     return redirect($this->redirectTo);
 }
Exemplo n.º 3
0
 /**
  * Display a listing of the users.
  *
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $users = User::all();
     return view('admin::users.list', compact('users'));
 }