php - Change and configure of App\User to a new directory -
there lots of questions question. explanations never complete. steps should take move file app\user app\entities\user
i have installed laravel 5.2 , have moved default app\user (app/user.php) folder app\entities , therefore changing namespace in user.php file namespace app\entities; access user model have use app\entities\user have changed setting in config\auth.php
'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => app\entities\user::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ],
the problem packages not work new directory wondering whether there other settings missing. example have installed package tymondesigns/jwt-auth getting error:
reflectionexception in container.php line 738: class app\user not exist
the package unable locate app\entities\user , uses default app\user think in file package tries load user model [ vendor\tymon\src\providers\jwtauthserviceprovider.php ]
$this->app['tymon\jwtauth\providers\user\userinterface'] = function ($app) { return $app['tymon.jwt.provider.user']; };
the package has config.php file setting isn't working either;
/* |-------------------------------------------------------------------------- | user model namespace |-------------------------------------------------------------------------- | | specify full namespace user model. | e.g. 'acme\entities\user' | */ 'user' => 'app\entities\user',
laravel 5 uses psr-4 autoloader, move models directory , change namespace in models.
after that, run composer dumpautoload -o
, everthing should work.
if after running command package not work, try use full namespace of user
model in package:
'user' => '\app\entities\user',
also, change namespace in config\auth.php
(thanks @user5500750 this):
'model' => app\entities\user::class,
Comments
Post a Comment