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


PHP UserRequest::except方法代码示例

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


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

示例1: 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

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(UserRequest $request)
 {
     $input = $request->except('roles');
     if ($request->has('password')) {
         $input['password'] = bcrypt($request->password);
     } else {
         unset($input['password']);
     }
     $record = $this->model->create($input);
     if ($request->has('roles')) {
         $record->syncRoles($request->roles);
     }
     $this->notify(['type' => 'success', 'title' => 'Successful create user!', 'description' => 'User is created successfully!']);
     return redirect(route('user.edit', ['id' => $record->id]));
 }
开发者ID:despark,项目名称:ignicms,代码行数:22,代码来源:UsersController.php

示例3: store

 /**
  * User create form processing.
  *
  * @return Redirect
  */
 public function store(UserRequest $request)
 {
     //upload image
     if ($file = $request->file('pic')) {
         $fileName = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension() ?: 'png';
         $folderName = '/uploads/users/';
         $destinationPath = public_path() . $folderName;
         $safeName = str_random(10) . '.' . $extension;
         $file->move($destinationPath, $safeName);
         $request->pic = $safeName;
     }
     //check whether use should be activated by default or not
     $activate = $request->get('activate') ? true : false;
     try {
         // Register the user
         $user = Sentinel::register($request->except('_token'), $activate);
         //add user to 'User' group
         $role = Sentinel::findRoleById($request->get('group'));
         if ($role) {
             $role->users()->attach($user);
         }
         //check for activation and send activation mail if not activated by default
         if (!$request->get('activate')) {
             // Data to be used on the email view
             $data = array('user' => $user, 'activationUrl' => URL::route('activate', [$user->id, Activation::create($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);
             });
         }
         // Redirect to the home page with success menu
         return Redirect::route('admin.users.index')->with('success', Lang::get('users/message.success.create'));
     } catch (LoginRequiredException $e) {
         $error = Lang::get('admin/users/message.user_login_required');
     } catch (PasswordRequiredException $e) {
         $error = Lang::get('admin/users/message.user_password_required');
     } catch (UserExistsException $e) {
         $error = Lang::get('admin/users/message.user_exists');
     }
     // Redirect to the user creation page
     return Redirect::back()->withInput()->with('error', $error);
 }
开发者ID:jeremyreese,项目名称:quotes,代码行数:49,代码来源:UsersController.php

示例4: storeImage

 /**
  * Save image to uploads folder and change the name to something unique
  *
  * @param UserRequest $request
  * @param $field
  * @return array
  */
 private function storeImage(UserRequest $request, $field)
 {
     $data = $request->except([$field]);
     if ($request->file($field)) {
         $file = $request->file($field);
         $request->file($field);
         $fileName = rename_file($file->getClientOriginalName(), $file->getClientOriginalExtension());
         $path = '/uploads/' . str_plural($field);
         $move_path = public_path() . $path;
         $file->move($move_path, $fileName);
         $data[$field] = $path . $fileName;
     }
     return $data;
 }
开发者ID:abada,项目名称:laravel-5-simple-cms,代码行数:21,代码来源:UserController.php

示例5: store

 public function store(UserRequest $request)
 {
     User::create($request->except(['_token']));
     return redirect('dash/user')->with('message', 'User was created success.');
 }
开发者ID:Yuth-Set,项目名称:cms,代码行数:5,代码来源:UserController.php

示例6: 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)
 {
     $input = $request->except('_method', '_token');
     $user = User::findOrFail($id);
     $password = $input['password'];
     unset($input['password']);
     if (!empty($password)) {
         $input['password'] = bcrypt($password);
     }
     if (!empty($input['profile_picture'])) {
     }
     if ($user->update($input)) {
         return redirect('/users');
     }
 }
开发者ID:zheralfin,项目名称:oras,代码行数:22,代码来源:UsersController.php

示例7: 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

示例8: update

 /**
  * Update the specified resource in storage.
  *
  * @param UserRequest $request
  * @param  int        $id
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(UserRequest $request, $id)
 {
     $this->repository->update($id, $request->except(['_token', '_method']));
     return redirect()->route('admin.users.index');
 }
开发者ID:jespersgaard,项目名称:tyloo,代码行数:13,代码来源:UsersController.php

示例9: postRegister

 /**
  * Account sign up form processing.
  *
  * @return Redirect
  */
 public function postRegister(UserRequest $request)
 {
     $activate = $this->user_activation;
     //make it false if you don't want to activate user automatically it is declared above as global variable
     try {
         // Register the user
         $user = Sentinel::register($request->except('_token'), $activate);
         //add user to 'User' group
         $role = Sentinel::findRoleByName('User');
         $role->users()->attach($user);
         //if you set $activate=false above then user will receive an activation mail
         if (!$activate) {
             // Data to be used on the email view
             $data = array('user' => $user, 'activationUrl' => URL::route('activate', [$user->id, Activation::create($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);
             });
             //Redirect to login page
             return Redirect::to("login")->with('success', Lang::get('auth/message.signup.success'));
         }
         // login user automatically
         Sentinel::login($user, false);
         // Redirect to the home page with success menu
         return Redirect::route("my-account")->with('success', Lang::get('auth/message.signup.success'));
         //return View::make('user_account')->with('success', Lang::get('auth/message.signup.success'));
     } catch (UserExistsException $e) {
         $this->messageBag->add('email', Lang::get('auth/message.account_already_exists'));
     }
     // Ooops.. something went wrong
     return Redirect::back()->withInput()->withErrors($this->messageBag);
 }
开发者ID:jeremyreese,项目名称:quotes,代码行数:38,代码来源:FrontEndController.php

示例10: update

 /**
  * 存储修改的用户信息
  *
  * @param  UserRequest  $request
  * @param  int  $id
  * @return Response
  */
 public function update(UserRequest $request, $id)
 {
     $old = $this->user->toArray();
     $except = array();
     $user = User::findOrFail($id);
     $registerState = $user->state;
     if ($user->state != 'register') {
         // 若已通过统一身份认证,禁止修改以下字段
         if (!empty($old['name'])) {
             $except[] = 'name';
         }
         if (!empty($old['gender'])) {
             $except[] = 'gender';
         }
         if (!empty($old['school'])) {
             $except[] = 'school';
         }
         if (!empty($old['student_id'])) {
             $except[] = 'student_id';
         }
         if (!empty($old['student_type'])) {
             $except[] = 'student_type';
         }
         if (!empty($old['department'])) {
             $except[] = 'department';
         }
         if ($user->state == 'auth') {
             $user->state = 'normal';
         }
     }
     $user->update($request->except($except));
     return redirect()->action('IndexController@redirect');
 }
开发者ID:xuhongxu96,项目名称:tagexing2,代码行数:40,代码来源:UsersController.php

示例11: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Requests\UserRequest $request)
 {
     $user = User::findOrFail($id);
     $input = $request->except('picture');
     foreach ($input as $key => $value) {
         if (empty($value)) {
             $input[$key] = null;
         }
     }
     $input['status'] = $this->status($request->status);
     $input['newsletter'] = zeroOrValue($request->newsletter);
     $input['zip'] = nullOrValue($request->zip);
     $input['country'] = nullOrValue($request->country);
     $input['billingZip'] = nullOrValue($request->billingZip);
     $input['billingCountry'] = nullOrValue($request->billingCountry);
     $user->update($input);
     $this->uploadPicture($request, $user->id);
     return redirect('admin/user')->withInput()->with(['flash_message' => true, 'flash_message_type' => 'success', 'flash_message_text' => 'Užívateľ bol úspešne upravený v databáze!']);
 }
开发者ID:svkmedia,项目名称:SVKmedia-CMS,代码行数:25,代码来源:AdminUserController.php

示例12: update

 public function update(User $user, Requests\UserRequest $request)
 {
     $user->update($request->except(['created_at', 'updated_at', 'user_role_name', 'email']));
     Flash::success(trans('admin/messages.adminUpdate'));
     return redirect(route('admin.admins.list'));
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:6,代码来源:AdminController.php

示例13: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(UserRequest $request, $id)
 {
     $user = User::findOrFail($id);
     $input = $request->except($this->pwd, 'permissions');
     if ($request->get($this->pwd) != '') {
         $input[$this->pwd] = bcrypt($request->get($this->pwd));
     }
     $user->fill($input);
     PartnerDistrict::where($this->partner_id, $id)->delete();
     if ($request->get('group_id') == 3) {
         static::updatesector($request, $id);
     }
     $user->save();
     Session::flash($this->success, Lang::get('ruban.user.updated'));
     return Redirect::route('ruban.users.index');
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:22,代码来源:UserController.php


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