• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Model\User类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: postRegister

 public function postRegister(Request $request)
 {
     $time = time();
     $user = new UserModel();
     $user->usr_name = $request->input('usr_name');
     $user->usr_email = $request->input('usr_email');
     $user->usr_password = Hash::make($request->input('usr_password'));
     $user->usr_access_token = md5(uniqid($time, $request->input('usr_email')));
     $user->usr_reset_token = md5(uniqid($time, $request->input('usr_email')));
     $user->usr_active_fg = true;
     $user->rol_id = 1;
     if (!$user->save()) {
         return 'error';
     }
 }
开发者ID:sochea09,项目名称:laravel-blog,代码行数:15,代码来源:AuthAdmin.php


示例17: registerAction

 public function registerAction()
 {
     if ($this->isPostRequest()) {
         $postdata = $this->getPostData();
         $postdata['password'] = md5($postdata['password']);
         $postdata['power'] = "mem";
         $count = User::getByEmail($postdata['email']);
         if ($count < 1) {
             $id = User::register($postdata);
             $_SESSION['logged']['id'] = $id;
             $_SESSION['logged']['name'] = $postdata['name'];
             $_SESSION['logged']['email'] = $postdata['email'];
             $_SESSION['logged']['power'] = $postdata['power'];
             return $this->redirectOldLink();
         } else {
             $data = $this->setData();
             $data['title'] = "Đăng ký thành viên";
             return $this->render("user/register.html.twig", $data);
         }
     } else {
         $data = $this->setData();
         $data['title'] = "Đăng ký thành viên";
         return $this->render("user/register.html.twig", $data);
     }
 }
开发者ID:haiquang9994,项目名称:sifoni_haiquang9994_,代码行数:25,代码来源:UserController.php


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


示例19: createDemand

    public static function createDemand(){
    	$validator = self::validator();
        if ($validator->fails()) {
            return back()->withErrors($validator->errors())->withInput();
        }

    	DB::transaction(function() use(&$warehouse){
    		$demand = Demand::create([
    			'type_id'	=>	1,
    			'title' 	=>	request('title'),
    			'user_id'   => User::user()->id,
    			'desc'      => request('desc'),
                'stage'     => 2,
    		]);

    		$warehouse = new self(request()->all());
    		$warehouse = $demand->warehouse()->save($warehouse);
    	});

    	if ($warehouse != null) {
    		return redirect('user/demand');
    	}else {
    		return back()->withErrors('创建失败')->withInput();
    	}
    }
开发者ID:xinray,项目名称:html-css,代码行数:25,代码来源:Warehouse.php


示例20: demand

    public function demand($id)
    {
        $demand = Demand::find($id);
        if ($demand == null) {
            return API::error([1002, '没有该需求信息']);
        }

        $user = User::user();
        if ($demand->user_id == $user->id) {
            return API::error([1003, '不能给自己创建的需求发送意见']);
        }

        $coop = Cooperation::create([
            'user_send' => $user->id,
            'user_recv' => $demand->user_id,
            'type'      => 'demand',
            'demand_id' => $demand->id,
            'supply_id' => null,
            'phone'     => request('phone'),
            'contacts'  => request('contacts'),
            'content'   => request('content'),
        ]);

        if ($coop == null) {
            return API::error([1004, '发送意向失败']);
        }

        return API::success();
    }
开发者ID:xinray,项目名称:html-css,代码行数:29,代码来源:CooperationController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP models\Account类代码示例发布时间:2022-05-23
下一篇:
PHP Requests\UserRequest类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap