2
你好,我是使用實施laravel 5.2密鑰驗證這個package使用API後衛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 有什麼建議嗎?
P.S對不起我的英文不好
我也跟着這個[link](https://blog.muya.co.ke/api-guard-laravel-5-2/) –