Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entrust Not Working With Lumen JWT #947

Open
Zubair-Iftikhar opened this issue May 27, 2019 · 1 comment
Open

entrust Not Working With Lumen JWT #947

Zubair-Iftikhar opened this issue May 27, 2019 · 1 comment

Comments

@Zubair-Iftikhar
Copy link

These Test Using Issue
Try 1:

<?php

namespace App;

use Illuminate\Auth\Authenticatable;
use Laravel\Lumen\Auth\Authorizable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Zizaco\Entrust\Traits\EntrustUserTrait;


class User extends Model implements AuthenticatableContract, AuthorizableContract, JWTSubject
{
    use Authenticatable, Authorizable;
    use EntrustUserTrait; // add this trait to your user model
//More code There
}

Error:

Trait method can has not been applied, because there are collisions with other trait methods on App\User

Try 2:

class User extends Authenticatable
{

    use EntrustUserTrait { restore as private restoreA; }
    use SoftDeletes { restore as private restoreB; }

    /**
    * fix collision on restore methods in SoftDelete trait and Entrust trait
    */
   public function restore()
   {
       $this->restoreA();
        $this->restoreB();
   }
//More code There

}

Error:

Class App\User cannot extend from trait Illuminate\Auth\Authenticatable

Try 3:

namespace App;

use Illuminate\Auth\Authenticatable;
use Laravel\Lumen\Auth\Authorizable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Zizaco\Entrust\Traits\EntrustUserTrait;


class User extends Model implements AuthenticatableInterface
{
     use SoftDeletes;
    use Authenticatable;
   use EntrustUserTrait { restore as private restoreA; }
    use SoftDeletes { restore as private restoreB; }
    public function restore()
    {
        $this->restoreA();
        $this->restoreB();
    }
}

Error:

Interface 'App\AuthenticatableInterface' not found
 

Environment

"php": ">=7.1.3",
"flipbox/lumen-generator": "^5.6",
"laravel/lumen-framework": "5.8.*",
"laravelista/lumen-vendor-publish": "^2.1",
"tymon/jwt-auth": "^1",
"vlucas/phpdotenv": "^3.3",
"zizaco/entrust": "5.2.x-dev"

@lucasdcrk
Copy link

This package is abandoned, you should consider using spatie/laravel-permission instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants