I have a problem with PHP intelephense, the method createToken is undefined. i don't know how to fix it. but when I run it in postman it works. i don't know why vscode doesnt recognize it. i also add the use Laravel\Passport\HasApiTokens; and use HasApiTokens in user model. please help me, I'm running out of options. thank you guys
public function login(Request $request)
{
$login = $request->validate([
'email' => 'required',
'password'=> 'required',
]);
if (!Auth::attempt($login)){
return response()->json(['message' => 'error']);
}
$user = Auth::user();
$token = $user->createToken('Token Name')->accessToken;
return response()->json(['user' => $user, 'token' => $token]);
}