admin管理员组文章数量:1123233
Latest Laravel with PHP 8.3 and intelephense plugin for autocomplete in VSC. If I using a method from a Model class Trait like createToken() in a User Model that using tokens, but the autocomplete is not working well. It is working inside the Model class, but when I use the model outside like in a Controller, it is not. The method itself is working, but no hint during the coding.
The beginning of the Model class:
. . .
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasFactory, Notifiable, HasApiTokens;
. . .
Then I try to use in controller the HasApiTokens method:
. . .
$user = User::where('email', $email)->first();
. . .
$user->tokens()->delete();
. . .
$user->token = $user->createToken('auth_token')->plainTextToken;
No codehint over the tokens() or createToken() or any Trait stuffz. The method itself is working well, so no program error but no hint during the coding.
The codes above is only part of the code, so now worry about what missing! It is only show the lines that is important in the problem.
本文标签: laravelVSC PHP Intelephense not see class trait in ControllerStack Overflow
版权声明:本文标题:laravel - VSC PHP Intelephense not see class trait in Controller - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736557785a1944603.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论