Zizaco / entrust

Role-based Permissions for Laravel 5
MIT License
6.05k stars 1.29k forks source link

{"message":"Unauthenticated.","status_code":500,"debug": #669

Open kaancetin opened 7 years ago

kaancetin commented 7 years ago

in Laravel 5.3 i am gettin this error {"message":"Unauthenticated.","status_code":500,"debug": when trying to run index method that return User::all(); in HomeController and in my api.php

`$api= app('Dingo\Api\Routing\Router');

//Route::get('/user', function (Request $request) {
//    return $request->user();
//})->middleware('auth:api');

$api->version('v1', function($api) {
    $api->get('hello', 'App\Http\Controllers\HomeController@index');
});` 

and my app\User.php,

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Zizaco\Entrust\Traits\EntrustUserTrait;

class User extends Authenticatable
{
    use Notifiable, EntrustUserTrait;

    protected $table = 'users';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'phone', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
}`

and Auth\User.php

namespace Illuminate\Foundation\Auth;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements
    AuthenticatableContract,
    //AuthorizableContract,
    CanResetPasswordContract
{
    use Authenticatable, /*Authorizable,*/ CanResetPassword;
}

Thanks for helps

d-arken commented 6 years ago

Did you fixed that? I'm having the same troubles.