コード例 #1
0
 /**
  * Ban user
  *
  * @param Request $request
  * @param $user
  * @return Redirect
  */
 public function ban(Request $request, $user)
 {
     $userToBan = $this->users->find($user);
     $userToBan->banned = 1;
     $userToBan->save();
     return redirect('/posts');
 }
コード例 #2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $user = $this->userRepository->find($this->authorizer->getResourceOwnerId());
     App::singleton('user', function () use($user) {
         return $user->toArray();
     });
     return $next($request);
 }
コード例 #3
0
 public function loginByCookie($cookie)
 {
     $user = $this->createOrUpdateUserByCookie($cookie);
     // Login
     $this->guard->login($user, true);
     // Return an actual user model if login passes
     if ($this->guard->check()) {
         return $this->userRepository->find($this->guard->id());
     } else {
         $errorMessage = 'Login error. User is not authorized. (binary_id: ' . $user->binary_id . ')';
         Log::error($errorMessage);
         throw new AuthException($errorMessage);
     }
 }
 /**
  * @param $id
  * @param UpdateUserRequest $request
  */
 public function update(UpdateUserRequest $request, $id)
 {
     $user = $this->user->find($id);
     $user->email = $request->get('email');
     if ($request->get('password')) {
         $user->password = $request->get('password');
     }
     $user->save();
     if ($request->get('role')) {
         $user->roles()->sync($request->get('role'));
     } else {
         $user->roles()->sync([]);
     }
     Flash::success('User successfully updated');
     return redirect('/users');
 }
コード例 #5
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(UserRepository $userRepository)
 {
     $user = $userRepository->find($this->user['id']);
     if (!Hash::check($this->params['old_password'], $user->password)) {
         throw new PasswordNotMatch();
     }
     $password = bcrypt($this->params['password']);
     return $userRepository->update($this->user['id'], ['password' => $password]);
 }
コード例 #6
0
 /**
  * Remove the specified User from storage.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $user = $this->userRepository->find($id);
     if (empty($user)) {
         Flash::error('User not found');
         return redirect(route('users.index'));
     }
     $this->userRepository->delete($id);
     Flash::success('User deleted successfully.');
     return redirect(route('users.index'));
 }
コード例 #7
0
 /**
  * @return \Illuminate\View\View
  */
 public function disableSelected(Request $request)
 {
     $chkUsers = $request->input('chkUser');
     if (isset($chkUsers)) {
         foreach ($chkUsers as $user_id) {
             $user = $this->user->find($user_id);
             if (!$user->canBeDisabled()) {
                 Flash::error(trans('admin/users/general.error.cant-be-disabled'));
             } else {
                 $user->enabled = false;
                 $user->save();
             }
         }
         Flash::success(trans('admin/users/general.status.global-disabled'));
     } else {
         Flash::warning(trans('admin/users/general.status.no-user-selected'));
     }
     return redirect('/admin/users');
 }
コード例 #8
0
 public function create($id, UserRepository $userRepository, Auth $auth)
 {
     $data = ['user' => $userRepository->find($id), 'authUser' => $auth->user()];
     return View('transactions.new')->with($data);
 }
 /**
  * @param Request $request
  * @return mixed
  */
 public function getInfo(Request $request)
 {
     $id = $request->input('id');
     $user = $this->user->find($id);
     return $user;
 }
コード例 #10
0
ファイル: UsersController.php プロジェクト: pet1330/tyloo
 /**
  * Show the form for editing the specified resource.
  *
  * @param int $id
  *
  * @return \Illuminate\View\View
  */
 public function edit($id)
 {
     $user = $this->users->find($id);
     return view('backend.users.edit', compact('user'));
 }
コード例 #11
0
ファイル: UserController.php プロジェクト: valdinei/rest
 /**
  * Display the specified resource.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function show($id)
 {
     $user = $this->repo->find($id);
     return view('');
 }
コード例 #12
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(UserRepository $userRepository)
 {
     $user = $userRepository->find($this->user['id']);
     return $user;
 }