2016-03-16 62 views
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对不起我的英文不好

+1

我也跟着这个[link](https://blog.muya.co.ke/api-guard-laravel-5-2/) –

回答

3

错误是3.0.3和3.1.0尝试降级之间引入到3.0.3可能会有所帮助。

你也可以尝试加入此块到app/config/apiguard.php文件更新最新的封装API-gaurd

0

修正这个对我的身材。

'providers'   => [ 
    'auth' => Chrisbjr\ApiGuard\Providers\Auth\Illuminate::class 
],