您好我正在使用此软件包在laravel 5.2中实现密钥身份验证
这给我一个错误
ErrorException in ApiGuardAuth.php line 14:
Argument 1 passed to Chrisbjr\ApiGuard\ApiGuardAuth::__construct() must be an instance of Chrisbjr\ApiGuard\Contracts\Providers\Auth, null given, called in E:\xammp\htdocs\vox\didww\vendor\chrisbjr\api-guard\src\Providers\ApiGuardServiceProvider.php on line 49 and defined
这是我的控制器
<?php
namespace App\Http\Controllers;
use Chrisbjr\ApiGuard\Models;
use Chrisbjr\ApiGuard\Http\Controllers\ApiGuardController;
class BooksController extends ApiGuardController
{
public function all()
{
return "die";
$books = \App\User::all();
return $this->response->withCollection($books, new BookTransformer);
}
public function show($id)
{
try {
$book = \App\User::findOrFail($id);
return $this->response->withItem($book, new BookTransformer);
} catch (ModelNotFoundException $e) {
return $this->response->errorNotFound();
}
}
}
我也更新了app.php和kernal.php有什么建议吗?
PS对不起,我的英语不好
该错误是在3.0.3和3.1.0之间引入的,请尝试将其降级为3.0.3可能会有所帮助。
您也可以尝试更新Api-gaurd的最新软件包
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句