<?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
These Test Using Issue Try 1:
Error:
Try 2:
Error:
Try 3:
Error:
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"