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

          <bdo id='I1QPi'></bdo><ul id='I1QPi'></ul>
        <legend id='I1QPi'><style id='I1QPi'><dir id='I1QPi'><q id='I1QPi'></q></dir></style></legend>
        <tfoot id='I1QPi'></tfoot>

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

        时间:2023-10-02
      2. <small id='d3Uto'></small><noframes id='d3Uto'>

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

                  <tbody id='d3Uto'></tbody>
              1. <legend id='d3Uto'><style id='d3Uto'><dir id='d3Uto'><q id='d3Uto'></q></dir></style></legend>

                • 本文介绍了如何使用带有自定义用户名列的 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:谷歌身份验证:OAuth2 不断返回“invalid_grant" 下一篇:实现 Oauth2 登录,致命错误:找不到“Google_Servic

                  相关文章

                  最新文章

                  <legend id='e7inY'><style id='e7inY'><dir id='e7inY'><q id='e7inY'></q></dir></style></legend>

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

                • <tfoot id='e7inY'></tfoot>

                      • <bdo id='e7inY'></bdo><ul id='e7inY'></ul>

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