コード例 #1
0
 /**
  * Allows a user to delete their account. The force option can be used, if we are working with a model
  * that uses the soft deletes trait
  *
  * @param bool $force
  *
  * @return bool|int|mixed
  */
 public function deleteAccount($force = false)
 {
     if ($force) {
         $this->user->forceDelete();
         // log the user out
         $this->auth->logout();
         return true;
     } else {
         $this->dataResult = $this->userRepository->delete([$this->user->id]);
         // log the user out
         $this->auth->logout();
         return $this->dataResult;
     }
 }
コード例 #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function edit($id)
 {
     // get a user and their roles
     $user = $this->user->getFirstBy('id', '=', $id, ['roles']);
     return view('backend.access-control.RevokeRoles', compact('user'));
 }
コード例 #3
0
 /**
  * @param CreateUserAccountRequest $accountRequest
  * @return $this|\Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function store(CreateUserAccountRequest $accountRequest)
 {
     $this->data = $this->users->createAccount($accountRequest->except('accept'), false);
     return $this->handleRedirect($accountRequest, route('backend.users.index'));
 }
コード例 #4
0
 /**
  * This will allow users to optionally create an account before making an order
  *
  * @param GuestCreateAccount $guestCreateAccount
  * @param CreateAccount $user
  *
  * @param UserRepository $registerUser
  * @return mixed
  */
 public function createAccount(GuestCreateAccount $guestCreateAccount, CreateAccount $user, UserRepository $registerUser)
 {
     // check the email
     $email = $this->guest->getGuestDetails()->email;
     $result = $registerUser->getFirstBy('email', '=', $email);
     if (!is_null($result)) {
         flash()->warning('Your email address is already in use. Please change it');
         return redirect()->back();
     }
     return $user->createAccount($guestCreateAccount, $registerUser)->handleRedirect($guestCreateAccount);
 }
コード例 #5
0
 /**
  * Enables a users account
  *
  * @param $user_id
  * @return bool
  */
 public function enableAccount($user_id)
 {
     $user = $this->userRepository->find($user_id);
     $user->disabled = false;
     return $user->save();
 }