本文整理汇总了PHP中app\User::whereId方法的典型用法代码示例。如果您正苦于以下问题:PHP User::whereId方法的具体用法?PHP User::whereId怎么用?PHP User::whereId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\User
的用法示例。
在下文中一共展示了User::whereId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$customer = Customer::whereId($id)->firstOrFail();
$user = User::whereId($customer->user_id)->firstOrFail();
// $register = User::whereId($customer->registered)->firstOrFail()->name;
return view('customer.show', compact('customer', 'user'));
}
示例2: profilstore
public function profilstore()
{
$user = User::whereId(Auth::user()->id)->first();
dd('à terminer');
alert()->success('...', 'Profil modifié !')->autoclose(3500);
return redirect('/membres/profil');
}
示例3: update_user
public function update_user(UserEditRequest $request)
{
$id = Auth::id();
$password = $request->get('old_password');
if (Auth::attempt(array('id' => $id, 'password' => $password))) {
$user = User::whereId($id)->firstOrFail();
$user->first_name = $request->get('first_name');
$user->last_name = $request->get('last_name');
$user->dob = $request->get('dob');
$user->email = $request->get('email');
$new_password = $request->get('password');
if ($new_password != "") {
$user->password = Hash::make($new_password);
}
$user->save();
$calendar = Calendar::where('user_id', '=', $id)->firstOrFail();
$calendar->name = $request->get('first_name');
$calendar->save();
$message = 'valid';
return $message;
} else {
$message = 'invalid';
return $message;
}
}
示例4: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
$user = User::whereId($id)->first();
$countries = array_merge(array('0' => 'Please Select'), DB::table('countries')->lists('name', 'id'));
return view('users/show', compact('countries', 'user'));
}
示例5: postComment
public function postComment(Request $request)
{
if ($request->ajax()) {
$user = User::whereId($request->get('user_id'))->first();
$commentText = $request->get('comment');
$this->comment->newComment($user, $commentText);
}
}
示例6: postProfile
public function postProfile()
{
$user = User::whereId(Auth::id())->first();
if ($user->update(Input::all())) {
return redirect()->back()->with('status', '个人资料更新成功');
}
return redirect()->back()->with('status', '个人资料更新失败');
}
示例7: update
public function update($id, UserEditFormRequest $request)
{
$user = User::whereId($id)->firstOrFail();
$user->name = $request->get('name');
$user->email = $request->get('email');
$password = $request->get('password');
if ($password != "") {
$user->password = Hash::make($password);
}
$user->save();
$user->saveRoles($request->get('role'));
return redirect(action('Admin\\UsersController@edit', $user->id))->with('status', 'The user has been updated!');
}
示例8: update
public function update($id, UserFormRequest $request)
{
$user = User::whereId($id)->firstOrFail();
$user->name = $request->get('name');
$user->email = $request->get('email');
$password = $request->get('password');
if ($password != "") {
$user->password = Hash::make($password);
}
$user->save();
$user->saveRoles($request->get('role'));
return redirect('/admin/users')->with('status', 'A felhasználó adatai módosítva!');
}
示例9: show
public function show(User $user)
{
if (!Entrust::hasRole('admin')) {
$user = User::whereId(Auth::user()->id)->first();
}
if (!$user) {
return redirect('/')->withErrors(config('constants.NA'));
}
$custom_field_values = Helper::getCustomFieldValues($this->form, $user->id);
$assets = ['hide_sidebar'];
$profile = $user->Profile;
$custom_field_values = Helper::getCustomFieldValues($this->form, $user->id);
return view('user.show', compact('custom_field_values', 'user', 'profile', 'assets', 'custom_field_values'));
}
示例10: update
/**
* Saves edits made to a user's profile.
*
* @param $id
* @return View
*/
public function update($id, ProfileFormRequest $request)
{
try {
$user = User::whereId($id)->firstOrFail();
} catch (ModelNotFoundException $e) {
return abort(404);
}
if (Auth::user()->id == $user->id) {
$profile = $user->profile()->first();
$profile->location = $request['location'];
$profile->bio = $request['bio'];
$profile->twitter_username = $request['twitter_username'];
$profile->instagram_username = $request['instagram_username'];
$profile->save();
flash()->success('Awesome!', 'Your profile has been successfully updated.');
return redirect("/users/{$user->id}");
}
return abort(404);
}
示例11: update
public function update($id)
{
$input = Input::all();
$rules = array();
$validator = Validator::make($input, $rules);
if ($validator->fails()) {
return Response::json(['success' => false, 'errors' => $validator->getMessageBag()->toArray()]);
} else {
$user = User::whereId($id)->firstOrFail();
if (Input::get('name') == '') {
$user->name = null;
} else {
$user->name = Input::get('name');
}
$user->save();
$user->saveRoles(Input::get('role'));
return Response::json(['success' => true, 'message' => 'The user has been updated!']);
}
}
示例12: show
public function show($id)
{
$order = Order::whereId($id)->firstOrFail();
$coffee1 = DB::table('coffees')->where('id', 1)->first();
$coffee2 = DB::table('coffees')->where('id', 2)->first();
$coffee3 = DB::table('coffees')->where('id', 3)->first();
$coffee4 = DB::table('coffees')->where('id', 4)->first();
$coffee5 = DB::table('coffees')->where('id', 5)->first();
$pastry1 = DB::table('pastries')->where('id', 1)->first();
$pastry2 = DB::table('pastries')->where('id', 2)->first();
$pastry3 = DB::table('pastries')->where('id', 3)->first();
$pastry4 = DB::table('pastries')->where('id', 4)->first();
$pastry5 = DB::table('pastries')->where('id', 5)->first();
$total = 0;
for ($i = 1; $i < 6; $i++) {
$total = ${'coffee' . $i}->price * $order->{'coffee' . $i} + ${'pastry' . $i}->price * $order->{'pastry' . $i} + $total;
}
$user = User::whereId($order->user_id)->firstOrFail();
$customer = Customer::whereId($order->customerid)->firstOrFail();
return view('order.show', compact('order', 'coffee1', 'coffee2', 'coffee3', 'coffee4', 'coffee5', 'pastry1', 'pastry2', 'pastry3', 'pastry4', 'pastry5', 'total', 'user', 'customer'));
}
示例13: postProfile
public function postProfile()
{
$inputData = Input::all();
$user = Auth::user();
$rules = array('email' => 'required|email|Unique:users,email,' . $user->id);
$niceNames = array('email' => '電子郵件');
$validator = Validator::make($inputData, $rules);
$validator->setAttributeNames($niceNames);
if ($validator->fails()) {
return Response::json(['success' => false, 'errors' => $validator->getMessageBag()->toArray()]);
} else {
$user = User::whereId($user->id)->firstOrFail();
if (Input::get('name') == '') {
$user->name = null;
} else {
$user->name = Input::get('name');
}
$user->email = Input::get('email');
$user->save();
//return success message
return Response::json(['success' => true, 'message' => '成功更新!']);
}
}
示例14: get_community_suggestions
public function get_community_suggestions()
{
try {
$com_sug = Doctors::whereDoc_type('NON_FORMAL')->orderBy('id', 'DESC')->limit(5)->get();
foreach ($com_sug as $doc) {
$temp['doc_id'] = $doc->id;
$temp['doc_first_name'] = $doc->first_name;
$temp['doc_last_name'] = $doc->last_name;
$temp['doc_address_2'] = $doc->address_2;
$temp['doc_city'] = $doc->city;
/* Get suggested User */
$non_formal = Non_Formal_doctors::whereDoctor_id($doc->id)->first();
$user = User::whereId($non_formal->suggested_user)->first();
$temp['sug_user_name'] = $user->name;
/* Get suggested User Image */
$img = Images::whereUser_id($user->id)->first();
$temp['image_path'] = $img->image_path;
$featured_main[] = $temp;
}
} catch (Exception $e) {
$this->LogError('Get Community Suggestion Doctors Function', $e);
}
return $featured_main;
}
示例15: update
/**
* Update the specified resource in storage.
* @param type int $id
* @param type Banlist $ban
* @param type BanlistRequest $request
* @return type Response
*/
public function update($id, User $ban, BanlistRequest $request)
{
try {
$bans = $ban->whereId($id)->first();
$bans->internal_note = $request->input('internal_note');
$bans->ban = $request->input('ban');
// dd($request->input('ban'));
if ($bans->save()) {
return redirect('banlist')->with('success', 'Banned Email Updated sucessfully');
} else {
return redirect('banlist')->with('fails', 'Banned Email not Updated');
}
} catch (Exception $e) {
return redirect('banlist')->with('fails', 'Banned Email not Updated');
}
}