当前位置: 首页>>代码示例>>PHP>>正文


PHP UserRequest::get方法代码示例

本文整理汇总了PHP中App\Http\Requests\UserRequest::get方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRequest::get方法的具体用法?PHP UserRequest::get怎么用?PHP UserRequest::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App\Http\Requests\UserRequest的用法示例。


在下文中一共展示了UserRequest::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: login

 public function login(UserRequest $request)
 {
     $credentials = array('name' => $request->get('name'), 'password' => $request->get('password'));
     if ($this->auth->attempt($credentials)) {
         $request->session()->flash('success', 'You are now logged in!');
     }
     return redirect('/');
 }
开发者ID:playatech,项目名称:weightlifter,代码行数:8,代码来源:UserController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(\App\Http\Requests\UserRequest $request)
 {
     $user = new \App\User();
     $user->name = $request->get('name');
     $user->email = $request->get('email');
     $user->password = Hash::make($request->get('password'));
     $user->role = $request->get('role');
     $user->save();
     return redirect()->action('UserController@index');
 }
开发者ID:jesslly,项目名称:laravel_vacation_request,代码行数:16,代码来源:UserController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(UserRequest $request)
 {
     $user = \Auth::user();
     $user->mobilenumber = $request->get('mobilenumber');
     $user->name = $request->get('name');
     if (!empty($request->get('password'))) {
         $user->password = bcrypt($request->get('password'));
     }
     $user->save();
     return redirect('/home');
 }
开发者ID:adnidor,项目名称:FfsNodeAlarm,代码行数:17,代码来源:UserController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(UserRequest $request, $id)
 {
     $user = User::findOrFail($id);
     $user->first_name = $request->get('first_name');
     $user->last_name = $request->get('last_name');
     $user->email = $request->get('email');
     $user->username = $request->get('username');
     $user->type = $request->get('type');
     $user->status = $request->get('status');
     $user->password = bcrypt($request->get('password'));
     $user->save();
     return redirect('user');
 }
开发者ID:jeanyu,项目名称:azredirentals,代码行数:20,代码来源:UserController.php

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @param  UserRequest  $request
  * @return Response
  */
 public function update(UserRequest $request, $id)
 {
     $user = User::findOrFail($id);
     if ($request->get('password') && Auth::attempt(['email' => $user->email, 'password' => $request->old_password])) {
         $request['password'] = bcrypt($request->get('password'));
     } elseif (!$request->get('password')) {
         $request['password'] = $user->password;
     } else {
         return redirect()->back()->withInput()->withErrors(['old_password' => 'Het opgegeven huidig wachtwoord is niet correct.']);
     }
     $user->update($request->only($user->getFillable()));
     $user->roles()->sync(collect($request->get('role'))->all());
     return redirect()->route('user.manager.index');
 }
开发者ID:gertjanroke,项目名称:users,代码行数:21,代码来源:UsersController.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  UserRequest  $request
  * @param  int  $id
  * @return Response
  */
 public function update(UserRequest $request, $id)
 {
     $user = User::findOrFail($id);
     if ($request->get('password') && bcrypt($request->get('old_password')) == $user->password) {
         $request['password'] = bcrypt($request->get('password'));
     } elseif (!$request->get('password')) {
         $request['password'] = $user->password;
     } else {
         return redirect()->back()->withInput()->withErrors(['password' => 'The given password is not correct.']);
     }
     $user->update($request->only($user->getFillable()));
     $user->roles()->sync(collect($request->get('role'))->all());
     return redirect()->route('user.manager.index');
 }
开发者ID:intothesource,项目名称:users,代码行数:21,代码来源:UsersController.php

示例7: update

 public function update(UserRequest $request, $id)
 {
     $user = User::find($id);
     if (!$user) {
         return ['error' => 1, 'message' => '用户不存在或已被删除!'];
     }
     switch ($request->get('attr')) {
         case 'admin':
             if ($user->is_admin > 0) {
                 if ($user->id == 1) {
                     return ['error' => 1, 'message' => '不能删除默认管理员账号!'];
                 }
                 $user->is_admin = 0;
                 $user->save();
                 return ['error' => 0, 'message' => '管理员权限移除成功!'];
             } else {
                 $user->is_admin = 1;
                 $user->save();
                 return ['error' => 0, 'message' => '管理员权限添加成功!'];
             }
             break;
         default:
             return ['error' => 1, 'message' => '不能修改该属性,请刷新!!'];
     }
 }
开发者ID:lakche,项目名称:timeCMS-free,代码行数:25,代码来源:UsersController.php

示例8: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(\App\Http\Requests\UserRequest $request, $id)
 {
     try {
         \DB::beginTransaction();
         $user = $this->users->findLoggedInUser();
         $this->users->updateSecondaryEmail($request->get('secondary_email'), $user->id);
         $this->users->updatePhones($request->get('phone'), $user->id);
         $this->users->updateAddress($request->get('address'), $user->id);
         \DB::commit();
     } catch (Exception $e) {
         \DB::rollback();
         \Session::flash('delete_message', 'Something went wrong.');
         return redirect('profile.edit', $user->id);
     }
     \Session::flash('update_message', 'Your profile has been updated');
     return redirect('profile');
 }
开发者ID:Johca,项目名称:Order-Portal,代码行数:24,代码来源:ProfileController.php

示例9: store

 /**
  * @param UserRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(UserRequest $request)
 {
     $user = new User();
     $user->name = $request->get('name');
     $user->email = $request->get('email');
     $user->confirmation_token = null;
     $user->password = $request->get('password');
     $user->active = 1;
     $user->confirmation_token = null;
     $user->save();
     $url = route('confirmation', ['email' => $user->email, 'token' => $user->confirmation_token]);
     Mail::send('emails.welcome', compact('user', 'url'), function ($m) use($user) {
         $m->from('tavo198718@gmail.com', 'My favorylinks');
         $m->to($user->email)->subject('Bienvenido!');
     });
     return redirect()->route('admin.users.index')->with('message', 'usuario Agregado');
 }
开发者ID:tavo1987,项目名称:linkbox,代码行数:21,代码来源:UserController.php

示例10: update

 public function update($id, UserRequest $request)
 {
     $data = $request->has('password') ? $request->all() : $request->except('password');
     $this->user->save($id, $data);
     if ($request->ajax()) {
         return response()->json(['status' => trans('messages.saved'), 'type' => 'success']);
     }
     $route = $request->get('task') == 'apply' ? route('admin.users.edit', $id) : route('admin.users.index');
     return redirect($route)->with(['status' => trans('messages.saved'), 'type' => 'success']);
 }
开发者ID:hramose,项目名称:laravel-5-admin,代码行数:10,代码来源:UserController.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(UserRequest $request)
 {
     User::create(['username' => $request->get('username'), 'fullname' => $request->get('fullname'), 'department' => $request->get('department'), 'email' => $request->get('email'), 'password' => bcrypt($request->get('password'))]);
     return redirect('users')->with('success', 'User Created Successfully');
 }
开发者ID:richardkeep,项目名称:Requisition,代码行数:11,代码来源:UserController.php

示例12: update

 /**
  * User update form processing page.
  *
  * @param  User $user
  * @param UserRequest $request
  * @return Redirect
  */
 public function update(User $user, UserRequest $request)
 {
     try {
         $user->first_name = $request->get('first_name');
         $user->last_name = $request->get('last_name');
         $user->email = $request->get('email');
         $user->dob = $request->get('dob');
         $user->bio = $request->get('bio');
         $user->gender = $request->get('gender');
         $user->country = $request->get('country');
         $user->state = $request->get('state');
         $user->city = $request->get('city');
         $user->address = $request->get('address');
         $user->postal = $request->get('postal');
         if ($password = $request->has('password')) {
             $user->password = Hash::make($password);
         }
         // is new image uploaded?
         if ($file = $request->file('pic')) {
             $extension = $file->getClientOriginalExtension() ?: 'png';
             $folderName = '/uploads/users/';
             $destinationPath = public_path() . $folderName;
             $safeName = str_random(10) . '.' . $extension;
             $file->move($destinationPath, $safeName);
             //delete old pic if exists
             if (File::exists(public_path() . $folderName . $user->pic)) {
                 File::delete(public_path() . $folderName . $user->pic);
             }
             //save new file path into db
             $user->pic = $safeName;
         }
         //save record
         $user->save();
         // Get the current user groups
         $userRoles = $user->roles()->lists('id')->all();
         // Get the selected groups
         $selectedRoles = $request->get('groups', array());
         // Groups comparison between the groups the user currently
         // have and the groups the user wish to have.
         $rolesToAdd = array_diff($selectedRoles, $userRoles);
         $rolesToRemove = array_diff($userRoles, $selectedRoles);
         // Assign the user to groups
         foreach ($rolesToAdd as $roleId) {
             $role = Sentinel::findRoleById($roleId);
             $role->users()->attach($user);
         }
         // Remove the user from groups
         foreach ($rolesToRemove as $roleId) {
             $role = Sentinel::findRoleById($roleId);
             $role->users()->detach($user);
         }
         // Activate / De-activate user
         $status = $activation = Activation::completed($user);
         if ($request->get('activate') != $status) {
             if ($request->get('activate')) {
                 $activation = Activation::exists($user);
                 if ($activation) {
                     Activation::complete($user, $activation->code);
                 }
             } else {
                 //remove existing activation record
                 Activation::remove($user);
                 //add new record
                 Activation::create($user);
                 //send activation mail
                 $data = array('user' => $user, 'activationUrl' => URL::route('activate', $user->id, Activation::exists($user)->code));
                 // Send the activation code through email
                 Mail::send('emails.register-activate', $data, function ($m) use($user) {
                     $m->to($user->email, $user->first_name . ' ' . $user->last_name);
                     $m->subject('Welcome ' . $user->first_name);
                 });
             }
         }
         // Was the user updated?
         if ($user->save()) {
             // Prepare the success message
             $success = Lang::get('users/message.success.update');
             // Redirect to the user page
             return Redirect::route('admin.users.edit', $user)->with('success', $success);
         }
         // Prepare the error message
         $error = Lang::get('users/message.error.update');
     } catch (UserNotFoundException $e) {
         // Prepare the error message
         $error = Lang::get('users/message.user_not_found', compact('user'));
         // Redirect to the user management page
         return Redirect::route('users')->with('error', $error);
     }
     // Redirect to the user page
     return Redirect::route('admin.users.edit', $user)->withInput()->with('error', $error);
 }
开发者ID:jeremyreese,项目名称:quotes,代码行数:98,代码来源:UsersController.php

示例13: store

 /**
  * Register User
  *
  * @param UserRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(UserRequest $request)
 {
     User::create(['name' => $request->get('name'), 'email' => $request->get('email'), 'password' => bcrypt($request->get('password'))]);
     return redirect('login')->with('flash_notification.message', 'User registered successfully')->with('flash_notification.level', 'success');
 }
开发者ID:softsolution,项目名称:laravel-todo,代码行数:11,代码来源:UserController.php

示例14: changePassword

 /**
  * Endpoint for changing the password.
  */
 public function changePassword(UserRequest $request)
 {
     // Get authenticated user
     $user = \Auth::user();
     // Get subset of actual input fields to consider
     $input = $request->getValidInputs();
     // Hash password
     $input['password'] = \Hash::make($input['password']);
     // Update user object
     $user->update($input);
     \Notifications::add('Your password has been changed.', 'success');
     if ($request->has('_redirect_url')) {
         return redirect($request->get('_redirect_url'));
     } else {
         return redirect()->route('user.settings');
     }
 }
开发者ID:Ravaelles,项目名称:Elder,代码行数:20,代码来源:UserController.php

示例15: update

 /**
  * Update the specified resource in storage.
  *
  * @return \Illuminate\Http\Response
  */
 public function update(UserRequest $request, $username)
 {
     $user = User::where(compact('username'))->firstOrFail();
     // Check authorisation and throw 404 if not
     if (!Auth::user()->allowedTo('edit', 'user', $user)) {
         return view('errors/404');
     }
     $user_request = $request->except('tabs');
     $tabs = $request->get('tabs');
     $password_reset = false;
     switch ($tabs) {
         case 'settings:info':
             // Empty State field if rest of address fields are empty
             if (!$request['address'] && !$request['suburb'] && !$request['postcode']) {
                 $user_request['state'] = '';
             }
             // Null email field if empty  - for unique validation
             if (!$request['email']) {
                 $user_request['email'] = null;
             }
             // Update status
             $request->get('status') ? $user->status = 1 : ($user->status = 0);
             $user->save();
         case 'settings:password':
             // encrypt password
             if ($request->get('password')) {
                 $user_request['password'] = bcrypt($user_request['password']);
             }
             // Password has ben set by someone other then user so force user to reset after login
             if (Auth::user()->id != $user->id) {
                 $user_request['password_reset'] = 1;
             }
             // Password has been reset by user after being set by another
             if (Auth::user()->password_reset && Auth::user()->id == $user->id) {
                 $user_request['password_reset'] = 0;
                 $password_reset = true;
             }
     }
     $user->update($user_request);
     if ($password_reset) {
         Toastr::success("Updated password");
         sleep(1);
         return redirect('/dashboard');
     }
     Toastr::success("Saved changes");
     $tabs = explode(':', $request->get('tabs'));
     return redirect('/user/' . $user->username . '/' . $tabs[0] . '/' . $tabs[1]);
 }
开发者ID:unclefudge,项目名称:whs,代码行数:53,代码来源:UserController.php


注:本文中的App\Http\Requests\UserRequest::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。