<i id='SsY7z'><tr id='SsY7z'><dt id='SsY7z'><q id='SsY7z'><span id='SsY7z'><b id='SsY7z'><form id='SsY7z'><ins id='SsY7z'></ins><ul id='SsY7z'></ul><sub id='SsY7z'></sub></form><legend id='SsY7z'></legend><bdo id='SsY7z'><pre id='SsY7z'><center id='SsY7z'></center></pre></bdo></b><th id='SsY7z'></th></span></q></dt></tr></i><div id='SsY7z'><tfoot id='SsY7z'></tfoot><dl id='SsY7z'><fieldset id='SsY7z'></fieldset></dl></div>
<tfoot id='SsY7z'></tfoot>

        • <bdo id='SsY7z'></bdo><ul id='SsY7z'></ul>
        <legend id='SsY7z'><style id='SsY7z'><dir id='SsY7z'><q id='SsY7z'></q></dir></style></legend>

      1. <small id='SsY7z'></small><noframes id='SsY7z'>

      2. 如何使用带有自定义用户名列的 Laravel Passport

        How to use Laravel Passport with a custom username column(如何使用带有自定义用户名列的 Laravel Passport)

          <small id='CqBJj'></small><noframes id='CqBJj'>

          • <i id='CqBJj'><tr id='CqBJj'><dt id='CqBJj'><q id='CqBJj'><span id='CqBJj'><b id='CqBJj'><form id='CqBJj'><ins id='CqBJj'></ins><ul id='CqBJj'></ul><sub id='CqBJj'></sub></form><legend id='CqBJj'></legend><bdo id='CqBJj'><pre id='CqBJj'><center id='CqBJj'></center></pre></bdo></b><th id='CqBJj'></th></span></q></dt></tr></i><div id='CqBJj'><tfoot id='CqBJj'></tfoot><dl id='CqBJj'><fieldset id='CqBJj'></fieldset></dl></div>
              • <bdo id='CqBJj'></bdo><ul id='CqBJj'></ul>
              • <legend id='CqBJj'><style id='CqBJj'><dir id='CqBJj'><q id='CqBJj'></q></dir></style></legend>

                <tfoot id='CqBJj'></tfoot>

                  <tbody id='CqBJj'></tbody>

                  本文介绍了如何使用带有自定义用户名列的 Laravel Passport的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  现在我正在使用类似的东西来验证我的基本站点上的用户:

                  Now I'm using something like that for authenticating the user on my base site:

                  if (Auth::attempt($request->only(['id', 'password']))) {
                              //
                  }
                  

                  如何修改此代码以使用自定义列作为用户名?https://laravel.com/docs/5.3/passport#password-grant-tokens

                  How can I modify this code for using custom column as username? https://laravel.com/docs/5.3/passport#password-grant-tokens

                  推荐答案

                  您可以在用户模型中使用 findForPassport 方法.

                  You can use findForPassport method in your user model.

                  该方法以用户名为参数,返回用户模型

                  This method take username as argument, and return user model

                  例如:

                  class User extends Authenticatable
                  {
                      use HasApiTokens, Notifiable;
                  
                      // ... some code
                  
                      public function findForPassport($username) {
                          return $this->where('id', $username)->first();
                      }
                  }
                  

                  这篇关于如何使用带有自定义用户名列的 Laravel Passport的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  • <bdo id='PGDgP'></bdo><ul id='PGDgP'></ul>

                  • <legend id='PGDgP'><style id='PGDgP'><dir id='PGDgP'><q id='PGDgP'></q></dir></style></legend>

                        <tbody id='PGDgP'></tbody>

                      <small id='PGDgP'></small><noframes id='PGDgP'>

                      <tfoot id='PGDgP'></tfoot>
                            <i id='PGDgP'><tr id='PGDgP'><dt id='PGDgP'><q id='PGDgP'><span id='PGDgP'><b id='PGDgP'><form id='PGDgP'><ins id='PGDgP'></ins><ul id='PGDgP'></ul><sub id='PGDgP'></sub></form><legend id='PGDgP'></legend><bdo id='PGDgP'><pre id='PGDgP'><center id='PGDgP'></center></pre></bdo></b><th id='PGDgP'></th></span></q></dt></tr></i><div id='PGDgP'><tfoot id='PGDgP'></tfoot><dl id='PGDgP'><fieldset id='PGDgP'></fieldset></dl></div>