本文整理匯總了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' => 'Сохранен']);
}
示例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');
}
示例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');
}
示例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');
}
示例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();
}
示例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.');
}
示例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);
}
示例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');
}
示例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();
}
示例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');
}
示例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!']);
}
}
示例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');
}
}
示例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();
}
示例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');
}
示例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();
}