/** * Display the specified resource. * * @param int $id * * @return Response */ public function show($id) { $user = User::where(['id' => $id])->first(); if ($user) { $userAttributes = $user->attributesToArray(); $userAttributes['links'] = ['addresses' => 'addresses']; return response()->json(['user' => $userAttributes]); } return response()->json([]); }
public function loginUser(Request $request) { // $logrepos = new LoginRepositori(); // $user = $logrepos->loginRepos($request->user,$request->password ) ; if ($user = User::where("name", $request->user)->first()) { if (Hash::check($request->password, $user->password)) { return view('user.index')->with("variable", $user)->with("test", "Hello there"); } } }
public function loginRepos($luser, $lpassword) { echo "{$luser}"; echo "{$lpassword}"; if ($user = User::where("name", $luser)->first()) { if (Hash::check($lpassword, $user->password)) { return view('user.index')->with("variable", $user)->with("test", "Hello there"); } } }
public function autocomplete() { $find = Input::get('term'); $queries = User::where('name', 'LIKE', '%' . $find . '%')->take(5)->get(); $results = array(); foreach ($queries as $query) { $results[] = ['id' => $query->id, 'value' => $query->name, 'city' => $query->city->name, 'delivery_time' => $query->city->delivery_time, 'city_id' => $query->city->id, 'address' => $query->address, 'phone' => $query->phone]; } return Response::json($results); }
/** * 创建用户事件 */ public static function generateUserCreateEvents() { // 三个虚拟订单自09-15始,设置用户加入时间小于09-15 \DB::update('UPDATE xb_user SET created_at = \'2015-09-10 12:12:12\' WHERE uid < 11'); $list = \App\Models\User\User::all(); foreach ($list as $k => $v) { // self::getsetEvent($v['created_at'], 'userCreate', ['uid' => $v['uid'], 'truename' => $v['truename'], 'phone' => $v['phone'], 'identity' => $v['identity'], 'created_at' => $v['created_at'] . '']); } \App\Models\User\User::where('uid', '>', 0)->delete(); return; }
public function getChangeConfirm(Request $request) { $detail = $this->getVerifiedDetail('email', $request); if (is_array($detail)) { User::where('id', $detail['user_id'])->update([$detail['type'] => $detail['value'], $detail['type'] . '_verified_at' => time()]); } return redirect('account/set#security'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $order = Order::find($id); $client = User::find($order->client_id); $products = OrderEntry::where('order_id', $order->id)->get(); $managers = User::where('role_id', '2')->lists('name', 'id'); return view('orders.edit', ['order' => $order, 'managers' => $managers, 'client' => $client, 'products' => $products]); }
public function getInvite() { $userId = (int) request()->input('u'); if (User::where('id', $userId)->exists()) { session(['inviter_uid', $userId]); } return redirect('account/create'); }