當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::update方法代碼示例

本文整理匯總了PHP中app\User::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::update方法的具體用法?PHP User::update怎麽用?PHP User::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\User的用法示例。


在下文中一共展示了User::update方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update

 /**
  * Update user
  *
  * @param UserUpdateRequest $request
  * @param $user
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(UserUpdateRequest $request, User $user)
 {
     $user->update($request->only('email', 'password') + ['name' => $request->get('username'), 'email' => $request->get('email')]);
     if ($request->has('password')) {
         $user->update($request->only('email', 'password') + ['password' => Hash::make($request->get('password'))]);
     }
     $user->roles()->sync($request->get('roles'));
     return redirect()->route('manager.user.index')->with(['message' => 'Сохранен']);
 }
開發者ID:devillom,項目名稱:simpleshop,代碼行數:16,代碼來源:UserController.php

示例2: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param User $user
  * @return Response
  * @internal param int $id
  */
 public function update(Request $request, User $user)
 {
     if ($request->get('password', false)) {
         $request->merge(['password' => bcrypt($request->get('password'))]);
         $user->update($request->all());
     } else {
         $user->update($request->except(['password']));
     }
     return redirect()->route('users.index');
 }
開發者ID:richardkeep,項目名稱:quiz,代碼行數:18,代碼來源:UserController.php

示例3: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, User $user)
 {
     $this->validate($request, ['email' => 'required|unique:users,email,' . $user->id, 'retype_password' => 'same:password']);
     if ($request->input('password') == "") {
         $updateRequest['email'] = $request->input('email');
         $updateRequest['role'] = $request->input('role');
         $user->update($updateRequest);
     } else {
         $request['password'] = \Hash::make($request->input('password'));
         $user->update($request->all());
     }
     \Flash::success('Your user has been Updated');
     return redirect('admin/users');
 }
開發者ID:maherelgamil,項目名稱:ketabat,代碼行數:20,代碼來源:UsersController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(User $user, Request $request)
 {
     $user->update($request->except('avatar'));
     if ($request->hasFile('avatar')) {
         $file = $request->file('avatar');
         $filename = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         $image = sha1($filename . time()) . '.' . $extension;
         $destinationPath = public_path('/uploads/avatar/');
         $request->file('avatar')->move($destinationPath, $image);
         $user->avatar = $image;
         $user->update();
     }
     flash()->info('Profil telah diperbarui!');
     return redirect('/dashboard/profil');
 }
開發者ID:kobeuu,項目名稱:bpb-sf,代碼行數:22,代碼來源:UsersController.php

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @param UserRequest $request
  * @param User $user
  * @return Response
  */
 public function update(UserRequest $request, User $user)
 {
     $user->update($request->all());
     $user->uploadAndSave();
     flash()->success("User has been successfully updated!");
     return redirect()->back()->withInput();
 }
開發者ID:vazmer,項目名稱:mudrosti-laravel,代碼行數:14,代碼來源:UserController.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \App\Project $project
  * @return Response
  */
 public function update(User $user)
 {
     $this->validate($request, $this->rules);
     $input = array_except(Input::all(), '_method');
     $user->update($input);
     return Redirect::route('users.show', $user->name)->with('message', 'User updated.');
 }
開發者ID:lshakeel,項目名稱:WE_Assignment3,代碼行數:13,代碼來源:UsersController.php

示例7: update

 /**
  * Update a record
  *
  * @param User $user
  * @param array $attributes
  * @return mixed
  * @throws \Exception
  */
 public function update($user, array $attributes = array())
 {
     if (!isset($attributes['activated'])) {
         $attributes['activated'] = 0;
     }
     return $user->update($attributes);
 }
開發者ID:vnzacky,項目名稱:dog,代碼行數:15,代碼來源:EloquentUserRepository.php

示例8: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(User $user, Request $request)
 {
     $this->validate($request, ['fullname' => 'required', 'email' => 'required|email']);
     // Uncomment and modify if you need to validate any input.
     $user->update($request->all());
     return redirect('users');
 }
開發者ID:richardkeep,項目名稱:tracker,代碼行數:13,代碼來源:UserController.php

示例9: users_update

 /**
  * Update an user record.
  *
  * @param User $user
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function users_update(User $user, Request $request)
 {
     $user->update($request->only('name', 'email'));
     // Mass assignable
     $user->group = $request->input('group');
     $user->save();
     return redirect()->back();
 }
開發者ID:reppair,項目名稱:admin,代碼行數:15,代碼來源:AdminController.php

示例10: update

 /**
  * Update the specified user in storage.
  *
  * @param  User  $user
  * @return Response
  */
 public function update(User $user, UpdateUserRequest $request)
 {
     $attributes = $request->only('name', 'email');
     if ($request->has('password')) {
         $attributes['password'] = $request->get('password');
     }
     $user->update($attributes);
     return redirect()->route('admin.users.index');
 }
開發者ID:AssociazionePrometeo,項目名稱:doorkeeper-web,代碼行數:15,代碼來源:UserController.php

示例11: update

 public function update(UserRequest $request, User $user)
 {
     try {
         $user->update($request->all());
         return response()->json(['errors' => 'false', 'message' => 'The project has been updated!']);
     } catch (\Exception $e) {
         return response()->json(['errors' => 'true', 'message' => 'Something went wrong!']);
     }
 }
開發者ID:jasonraimondi,項目名稱:twitterclone,代碼行數:9,代碼來源:UserController.php

示例12: update

 /**
  * Update the specified resource in storage.
  *
  * @param  UserRequest  $request
  * @param  User $user
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(UserRequest $request, User $user)
 {
     $user->update($request->all());
     if (Request::wantsJson()) {
         return $user;
     } else {
         return redirect('admin/user');
     }
 }
開發者ID:Rhincodon,項目名稱:test-laravel,代碼行數:16,代碼來源:UserController.php

示例13: update

 /**
  * Update the specified user in storage.
  *
  * @param  \Illuminate\Http\Request     $request
  * @param  \App\User                    $user
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, User $user)
 {
     $user->update($request->except('biography', 'contactDetails', 'address'));
     $user->biography()->updateOrCreate([], $request->biography);
     $user->contactDetails()->updateOrCreate([], $request->contactDetails);
     $user->profile()->updateOrCreate([], $request->profile);
     $user->address()->updateOrCreate([], $request->address);
     \Notification::success("Künstler erfolgreich aktualisiert.");
     return back();
 }
開發者ID:LichtAnd,項目名稱:nkg,代碼行數:17,代碼來源:UserController.php

示例14: update

 public function update(Request $request, User $user)
 {
     //		$this->validate($request, [
     //			'name' => 'required|max:255',
     //			'email' => 'required|email|max:255|unique:users,email,'.$user->id
     //		]);
     $user->update([$request->get('name') => $request->get('value')]);
     \Session::flash('flash-success', 'ユーザを更新しました。');
     return redirect('/users');
 }
開發者ID:wakin-,項目名稱:bbs,代碼行數:10,代碼來源:UserController.php

示例15: update

 /**
  * Function to update Users Email, Username, Password
  * (Some work still needs to be done on the Authentication)
  *
  * @param UpdateUserDataRequest $request
  * @return view
  */
 public function update(UpdateUserDataRequest $request, User $UserData)
 {
     if (\Hash::check($request->input('password_old'), $UserData->password)) {
         $UserData->update(['password' => bcrypt($request->input('password')), 'email' => $request->input('email'), 'username' => $request->input('username')]);
         session()->flash('success_message', 'You have updated your profile Successfully!');
         return back();
     }
     session()->flash('failure_message', 'The Password you entered is not what we have on record');
     return back()->withInput();
 }
開發者ID:Core-Tech-Labs,項目名稱:LAZ,代碼行數:17,代碼來源:SettingsController.php


注:本文中的app\User::update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。