Laravel 5.6调用未定义的方法照亮\\ Auth \\ GenericUser :: withAccessToken()

时间:2018-05-06 13:44:10

标签: laravel laravel-5

我正在尝试访问需要访问令牌的API端点。我已成功使用$ u-> createToken(' MyApp') - > accessToken生成访问令牌,但当我尝试访问端点时,我收到以下错误:

  

调用未定义的方法   Illuminate \ Auth \ GenericUser :: withAccessToken()"," exception":   " Symfony的\元器件\调试\异常\ FatalThrowableError"

路线

Route::group(['middleware' => 'auth:api'], function(){
    Route::get('/details/{user}', 'SignupController@allInvites');
});

控制器

public function allInvites(Request $request)
{
    $user = $request->user;
    $data = Posts::allInvites($user);
    // returns number of invites
    return response()->json($data, 200);
}

邮差

enter image description here

用户提供商 - Auth.php

不使用雄辩的

'providers' => [
    'users' => [
        'driver' => 'database',
        'table' => 'users',
    ],

    // 'users' => [
    //     'driver' => 'database',
    //     'table' => 'users',
    // ],
],

0 个答案:

没有答案