当前位置: 首页>>代码示例>>PHP>>正文


PHP User::find方法代码示例

本文整理汇总了PHP中App\Model\User::find方法的典型用法代码示例。如果您正苦于以下问题:PHP User::find方法的具体用法?PHP User::find怎么用?PHP User::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App\Model\User的用法示例。


在下文中一共展示了User::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUser

 /**
  * @return User
  */
 public function getUser()
 {
     if (empty($this->user) && !empty($this->user_id)) {
         $this->user = User::find($this->user_id);
     }
     return $this->user;
 }
开发者ID:minutephp,项目名称:framework,代码行数:10,代码来源:UserEvent.php

示例2: user

 public function user($id)
 {
     $user = \App\Model\User::find($id);
     $posts = $user->posts()->paginate(25);
     $s = $user->name;
     return view('post/list')->with('posts', $posts)->with('type', ['name' => 'tag', 'title' => "\"{$s}\"发表"]);
 }
开发者ID:kpaxer,项目名称:shcms,代码行数:7,代码来源:PostController.php

示例3: send

 public function send($id, UserMessage $userMessage, User $user)
 {
     $curUserId = $this->current_user->id;
     $userPage = $user->find($id);
     $userMsg = $userMessage->where('user_id', '=', $curUserId)->where('user_send_id', '=', $id)->with('user')->with('userSend')->get();
     return view('pages.messages.send', compact('userPage', 'userMsg'));
 }
开发者ID:kilowat,项目名称:books,代码行数:7,代码来源:MessagesController.php

示例4: index

 public function index(string $jwt, string $url = '')
 {
     if ($payload = $this->jwtEx->decode($jwt)) {
         if ($user_id = $payload->user_id ?? 0) {
             if ($user = User::find($user_id)) {
                 if (!empty($payload->authorize)) {
                     /** @var User $user */
                     if ($user->verified == 'n') {
                         $user->ip_addr = $this->sniffer->getUserIP();
                         $user->verified = 'y';
                         $user->save();
                     }
                     $this->session->startSession($user_id);
                 }
                 if (!empty($payload->eventName)) {
                     $event = new UserEvent($user_id, $user->toArray());
                     $event->setData($payload->eventData ?? '');
                     $this->dispatcher->fire($payload->eventName, $event);
                 }
             }
         }
     } else {
         $params = ['msg' => 'Sorry this link has expired'];
     }
     return new Redirection($url ?: '/', $params ?? []);
 }
开发者ID:minutephp,项目名称:auth,代码行数:26,代码来源:Fwd.php

示例5: become

 /**
  * Become a user without having to login.
  */
 public function become($username)
 {
     $user = User::find($username);
     if ($user) {
         $this->user = $user;
         $_SESSION['username'] = $user;
     }
 }
开发者ID:spencerbaer,项目名称:CS457Project,代码行数:11,代码来源:AuthController.php

示例6: changePassword

 /**
  * Change user password
  * POST
  *
  * @param Request $request
  * @return Response
  */
 public function changePassword(Request $request)
 {
     $this->validate($request, ['oldPass' => 'required|alpha_num|exists:accounts,pass,guid,' . Auth::user()->guid, 'answer' => 'required|exists:accounts,reponse,guid,' . Auth::user()->guid, 'newPass' => 'required|alpha_num|min:4']);
     $user = UserManager::find(Auth::user()->guid);
     $user->pass = $request->newPass;
     $user->save();
     return redirect()->route('profile');
 }
开发者ID:synthx,项目名称:infuse,代码行数:15,代码来源:UserController.php

示例7: user_tasks

 public function user_tasks($uid)
 {
     $user = User::find($uid);
     if (empty($user)) {
         abort(404);
     } else {
         var_dump($user->tasks);
     }
 }
开发者ID:php-proj,项目名称:quickstart-intermediate,代码行数:9,代码来源:TestController.php

示例8: show

 public function show($id = null)
 {
     $user = User::find($id);
     if (!$user->isCurrent()) {
         die;
     }
     $this->viewData['user'] = $user;
     return view('profiles.show', $this->viewData);
 }
开发者ID:NgTheThao,项目名称:new-blog-52,代码行数:9,代码来源:ProfilesController.php

示例9: confirmPaiement

 /**
  * Buy points
  * POST
  *
  * @param Request $request
  * @return Response
  */
 public function confirmPaiement(Request $request)
 {
     $this->validate($request, ['code' => 'required|alpha_num']);
     $dedipass = json_decode(file_get_contents('http://api.dedipass.com/v1/pay/?public_key=' . config('config.dedipass.public') . '&private_key=' . config('config.dedipass.private') . '&code=' . $request->code));
     if ($dedipass->status != 'success') {
         return redirect()->back();
     }
     $user = UserManager::find(Auth::user()->guid);
     $user->points += config('config.points.buy');
     $user->save();
     return redirect()->route('home');
 }
开发者ID:synthx,项目名称:infuse,代码行数:19,代码来源:PointsController.php

示例10: update

 public function update($email, $password)
 {
     if (!empty($email) && !empty($password) && filter_var($email, FILTER_VALIDATE_EMAIL)) {
         if ($user = User::find($this->session->getLoggedInUserId())) {
             $event = new UserUpdateDataEvent($user, ['email' => $email, 'password' => $password]);
             $this->dispatcher->fire(UserUpdateDataEvent::USER_UPDATE_DATA, $event);
             if ($event->isHandled()) {
                 return 'pass';
             }
         }
     }
     throw new UserUpdateDataError("Unable to update credentials");
 }
开发者ID:minutephp,项目名称:first-run,代码行数:13,代码来源:Complete.php

示例11: iron

 /**
  * php artisan queue:listen --queue=TestQue
  */
 public function iron()
 {
     // $ironmq = new IronMQ(array(
     //     'project_id' => env('IRON_PROJECT_ID'),
     //     'token' => env('IRON_TOJEN'),
     //     'host' => env('IRON_HOST')
     // ));
     // $ironmq->ssl_verifypeer = false;
     // $ironmq->postMessage(env('IRON_QUEUE'), "Test Message FROM " . __CLASS__ . ':' . __FUNCTION__);
     $job = with(new SendReminderEmail(User::find(89)))->onQueue(env('IRON_QUEUE'))->delay(15);
     $this->dispatch($job);
     return __CLASS__ . ':' . __FUNCTION__ . ':' . env('IRON_QUEUE');
 }
开发者ID:jocoonopa,项目名称:lubri,代码行数:16,代码来源:TestController.php

示例12: userData

 public function userData($userData, $userId)
 {
     $user = User::find($userId);
     //Check if user exist
     if (!$user) {
         $user = new User();
     }
     $user->name = $userData['name'];
     $user->email = $userData['email'];
     $user->password = Hash::make($userData['password']);
     $user->save();
     return $user;
 }
开发者ID:haster312,项目名称:laravel_rikkei,代码行数:13,代码来源:UserBusiness.php

示例13: confirmCode

 /**
  * Confirm code and give reward
  * POST
  *
  * @param Request $request
  * @param string $key
  * @return Response
  */
 public function confirmCode(Request $request, $key)
 {
     $user = UserManager::find(Auth::user()->guid);
     $code = CodeManager::find($key);
     $code->use -= 1;
     $code->accounts .= $user->guid . '|';
     $code->save();
     switch ($code->action) {
         case 1:
             //Give points
             $user->points += $code->param;
             $user->save();
             break;
         case 2:
             //Give tokens
             $token = \App\Model\TokensAccount::where('guid', $user->guid)->where('token', $code->param)->first();
             if (!$token) {
                 $token = new \App\Model\TokensAccount();
                 $token->guid = $user->guid;
                 $token->token = $code->param;
                 $token->quantity = 1;
             } else {
                 $token->quantity += 1;
             }
             $token->save();
             break;
         case 3:
             //Give item
             $this->validate($request, ['player' => 'required|numeric|exists:personnages,guid']);
             $this->GiveObject($request->player, $code->param);
             break;
         case 4:
             //Give itemsets
             $this->validate($request, ['player' => 'required|numeric|exists:personnages,guid']);
             $itemset = \App\Model\Itemset::find($code->param);
             $exp = explode(',', $itemset->items);
             foreach ($exp as $id) {
                 $this->_giveObject($request->player, $id);
             }
             break;
     }
     if ($code->use == 0) {
         $code->delete();
     }
     return redirect()->route('gift.code');
 }
开发者ID:synthx,项目名称:infuse,代码行数:54,代码来源:GiftController.php

示例14: index

 public function index($_params)
 {
     if (!empty($_params['password'])) {
         if ($user = User::find($this->session->getLoggedInUserId())) {
             $event = new UserUpdateDataEvent($user, ['password' => $_params['password']]);
             $this->dispatcher->fire(UserUpdateDataEvent::USER_UPDATE_DATA, $event);
             if ($event->isHandled()) {
                 return json_encode(['update' => 'PASSWORD_RESET']);
             } else {
                 throw new UserUpdateDataError($event->getError() ?: 'UNKNOWN_ERROR');
             }
         } else {
             throw new UserUpdateDataError('UNKNOWN_USER');
         }
     } else {
         throw new UserUpdateDataError('INVALID_DATA');
     }
 }
开发者ID:minutephp,项目名称:auth,代码行数:18,代码来源:CreatePasswordHandler.php

示例15: index

 public function index(int $ar_list_id)
 {
     $user_ids = $this->listManager->getTargetUserIds($ar_list_id);
     $out = fopen('php://output', 'w');
     $this->response->asFile(sprintf('ar_download_list_%d.csv', $ar_list_id), 'text/csv');
     /** @var User $user */
     foreach (User::find($user_ids ?? [0]) as $user) {
         $attrs = $user->attributesToArray();
         unset($attrs['password']);
         unset($attrs['ident']);
         if (empty($header)) {
             $header = true;
             fputcsv($out, array_keys($attrs));
         }
         fputcsv($out, $attrs);
     }
     fclose($out);
 }
开发者ID:minutephp,项目名称:autoresponder,代码行数:18,代码来源:Download.php


注:本文中的App\Model\User::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。