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


PHP Model\User类代码示例

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


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

示例1: discover

 /**
  * {@inheritDoc}
  */
 public function discover(User $user)
 {
     $client = clone $this->client;
     $client->setDefaultOption('headers/Authorization', 'token ' . $user->getProviderAccessToken('github'));
     $request = $client->get('/user/orgs');
     $response = $request->send();
     $data = $response->json();
     $orgRequests = [$client->get('/user/repos')];
     foreach ($data as $org) {
         $this->logger->debug(sprintf('adding "' . $org['repos_url'] . '" for crawl'));
         $orgRequests[] = $client->get($org['repos_url']);
     }
     $orgResponses = $client->send($orgRequests);
     $composerRequests = [];
     foreach ($orgResponses as $orgResponse) {
         $this->fetchRepos($orgResponse);
         if ($orgResponse->hasHeader('link')) {
             $link = $orgResponse->getHeader('link');
             if (preg_match('/.* <(.+?)\\?page=(\\d+)>; rel="last"$/', $link, $matches)) {
                 $pagesRequests = [];
                 for ($i = 2; $i <= $matches[2]; $i++) {
                     $this->logger->debug(sprintf('adding "' . ($matches[1] . '?page=' . $i) . '" for crawl'));
                     $pagesRequests[] = $client->get($matches[1] . '?page=' . $i);
                 }
                 $pagesResponses = $client->send($pagesRequests);
                 foreach ($pagesResponses as $pagesResponse) {
                     $this->fetchRepos($pagesResponse);
                 }
             }
         }
     }
     return $this->getImportableProjects();
 }
开发者ID:blazarecki,项目名称:stage1,代码行数:36,代码来源:Discover.php

示例2: new_user

 /**
  * @inheritdoc
  */
 public function new_user($access_token, $return_url, $display_mode)
 {
     $config = 'default';
     $data = $this->provider->request("https://api.vk.com/method/users.get?" . "user_id={$this->user_id}" . "&fields=" . implode(',', $this->pixie->config->get("auth.{$config}.login.vkontakte.permissions", array())) . "&v={$this->pixie->config->get("auth.{$config}.login.vkontakte.api_version", 5.2)}" . "&access_token=" . $access_token);
     $data = json_decode($data);
     $data = current($data->response);
     //Save the new user
     $model = new User($this->pixie);
     $user = $model->saveOAuthUser('vk' . $data->id, $data->id, 'vkontakte');
     $user->first_name = $data->first_name;
     $user->last_name = $data->last_name;
     $user->save();
     //Get the 'pixie' role
     /*
            $role=$this->pixie->orm->get('role')
                ->where('name','pixie')
                ->find();
     
            //Add the 'pixie' role to the user
            $fairy->add('roles',$role);
     */
     //Finally set the user inside the provider
     $this->provider->set_user($user, $access_token);
     //And redirect him back.
     $this->return_to_url($display_mode, $return_url);
 }
开发者ID:nchervyakov,项目名称:evolve2,代码行数:29,代码来源:Vkontakte.php

示例3: new_user

 public function new_user($access_token, $return_url, $display_mode)
 {
     //Facebook provider allows use to request
     //URLs with CURL, but you can use any other way of
     //fetching a URL here.
     $data = $this->provider->getTwitterUser($access_token);
     $data = json_decode($data);
     //Save the new user
     $model = new User($this->pixie);
     $user = $model->saveOAuthUser('tw' . $data->id, $data->id, 'twitter');
     $nameParts = preg_split('/\\s+/', $data->name, -1, PREG_SPLIT_NO_EMPTY);
     $user->first_name = $nameParts[0];
     $user->last_name = $nameParts[1];
     $user->save();
     //Get the 'pixie' role
     /*
            $role=$this->pixie->orm->get('role')
                ->where('name','pixie')
                ->find();
     
            //Add the 'pixie' role to the user
            $fairy->add('roles',$role);
     */
     //Finally set the user inside the provider
     $this->provider->set_user($user, $access_token);
     //And redirect him back.
     $this->return_to_url($display_mode, $return_url);
 }
开发者ID:nchervyakov,项目名称:evolve2,代码行数:28,代码来源:Twitter.php

示例4: emailReminder

 /**
  * @testdox Requesting a password reminder adds an item to the Mail Queue.
  * @test
  */
 public function emailReminder()
 {
     $user = new User(['username' => 'test']);
     $user->save();
     $user->sendPasswordReminder();
     $this->assertEquals(1, QueuedEmail::count());
 }
开发者ID:samwilson,项目名称:asset-manager,代码行数:11,代码来源:UserTest.php

示例5: upExtDate

 private function upExtDate(\App\Model\User $user)
 {
     if (\Input::file('avatar')) {
         $user->avatar()->delete();
         \App\Model\File::create(['file' => \Input::file('avatar'), 'type' => 'avatar', 'name' => $user->id]);
     }
 }
开发者ID:kpaxer,项目名称:shcms,代码行数:7,代码来源:UserController.php

示例6: 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

示例7: new_user

 /**
  * @inheritdoc
  */
 public function new_user($access_token, $return_url, $display_mode)
 {
     $data = $this->provider->request("https://www.googleapis.com/plus/v1/people/me?access_token=" . $access_token);
     $data = json_decode($data, true);
     //Save the new user
     $model = new User($this->pixie);
     $user = $model->saveOAuthUser('gl' . $data['id'], $data['id'], 'google');
     if (is_array($data['emails']) && count($data['emails'])) {
         $user->email = $data['emails'][0]['value'];
     }
     if (is_array($data['name'])) {
         $user->first_name = $data['name']['givenName'];
         $user->last_name = $data['name']['familyName'];
     }
     $user->save();
     //Get the 'pixie' role
     /*
            $role=$this->pixie->orm->get('role')
                ->where('name','pixie')
                ->find();
     
            //Add the 'pixie' role to the user
            $fairy->add('roles',$role);
     */
     //Finally set the user inside the provider
     $this->provider->set_user($user, $access_token);
     //And redirect him back.
     $this->return_to_url($display_mode, $return_url);
 }
开发者ID:nchervyakov,项目名称:evolve2,代码行数:32,代码来源:Google.php

示例8: index

 public function index()
 {
     $this->setTitle("Home");
     $user = new User();
     $this->view->id = $user->getUsers();
     $this->render("index", "layout");
 }
开发者ID:evertonto,项目名称:mysql,代码行数:7,代码来源:Home.php

示例9: create

 /**
  * Create and save a new user.
  *
  * @param array
  */
 public function create()
 {
     // Validate input
     $params = array('username' => $this->app->request->post('username'), 'email_address' => $this->app->request->post('email_address'), 'password_hash' => Password::hash($this->app->request->post('password')));
     $user = new User($params);
     $user->save();
     $this->app->redirectTo('home');
 }
开发者ID:spencerbaer,项目名称:CS457Project,代码行数:13,代码来源:UserController.php

示例10: save

 public function save()
 {
     $di = $this->getDi();
     $em = $di['doctrine']();
     $user = new User();
     $user->setEntityManager($em);
     $user->update();
     header('Location: /users');
 }
开发者ID:erikfig,项目名称:Curso-PHP-Moderno,代码行数:9,代码来源:UsersController.php

示例11: startup

 public function startup()
 {
     parent::startup();
     $this->basePath = $this->template->basePath;
     $this->publicPath = $this->basePath . '/www';
     $this->user = parent::getUser();
     $this->activeMenuItem = 'Homepage';
     if ($this->user->isLoggedIn()) {
         $this->user->startup();
     }
 }
开发者ID:janeczko,项目名称:vpp,代码行数:11,代码来源:BasePresenter.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: user

 public function user(User $user)
 {
     $status = $user['status'];
     if ($status == userEnum::STATUS_OK) {
         $tpl = $user->level == \App\Enum\User::LEVEL_1 ? 'vip' : 'svip';
         $user->load(array('gallery' => function ($query) {
             return $query->where('status', \App\Enum\User::GALLERY_OK);
         }));
         return $this->view($tpl)->with('user', $user);
     } else {
         return \Redirect::back()->with('status', '该会员尚未通过审核');
     }
 }
开发者ID:netxinyi,项目名称:meigui,代码行数:13,代码来源:MemberController.php

示例14: getlist

 public function getlist(User $User, Bar $bar)
 {
     if (!isset($input['email'])) {
         return response('請輸入帳號', '403');
     } elseif (!isset($input['passwd'])) {
         return response('請輸入密碼', '403');
     }
     if ($User->CheckMember($input['email'], $input['passwd'])) {
         $baridlist = $bar->GetList($User->GetUserId);
         $baridlist->status = "success";
         return response()->json($baridlist);
     }
 }
开发者ID:RenZero,项目名称:HeroEverything,代码行数:13,代码来源:BloodApiController.php

示例15: createBetaSignup

 /**
  * @param User $user
  *
  * @return BetaSignup
  */
 private function createBetaSignup(User $user)
 {
     $em = $this->get('doctrine')->getManager();
     $repo = $em->getRepository('Model:BetaSignup');
     if (null === ($beta = $repo->findOneByEmail($user->getEmail()))) {
         $beta = new BetaSignup();
         $beta->setBetaKey(md5(uniqid()));
         $beta->setEmail($user->getEmail());
         $beta->setTries($user->getWaitingList());
         $beta->setStatus(BetaSignup::STATUS_DEFAULT);
         $em->persist($beta);
     }
     return $beta;
 }
开发者ID:blazarecki,项目名称:stage1,代码行数:19,代码来源:OAuthController.php


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