本文整理汇总了PHP中app\Profile::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::update方法的具体用法?PHP Profile::update怎么用?PHP Profile::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Profile
的用法示例。
在下文中一共展示了Profile::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Profile $profile)
{
$this->validate($request, Profile::validationRules());
$profile->update($request->all());
return redirect('/profile');
}
示例2: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Profile $profile, Image $img)
{
$this->validate($request, ['photo' => 'image|max:4000', 'gender' => 'required', 'name' => 'required|max:70', 'bio' => 'max:4500', 'phone' => 'max:50', 'education' => 'max:150', 'skills' => 'max:90', 'work' => 'max:100', 'location' => 'max:100']);
$user = $profile->user;
//Update the User name with the new value passed
$user->name = $request->input('name');
$user->save();
// Save the image
$photoPath = $this->saveImage($request, $user);
$profile->update($request->all());
$profile->photo = $photoPath;
$profile->save();
if ($request->ajax()) {
return response()->json(['success' => 1, 'data' => $user]);
}
return redirect()->route('admin.profiles.index')->withSuccess("Your profile has been updated...");
}