當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。