如何在laravel 5.2 zizaco entrust:migration类名验证中修复? [英] How to fix in laravel 5.2 zizaco entrust:migration class name validation?

查看:98
本文介绍了如何在laravel 5.2 zizaco entrust:migration类名验证中修复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已遵循GitHub 链接上的zizac/entrust安装教程,但遇到错误:

I have followed zizac/entrust installation tutorial from GitHub Link and faced with error:

类名必须是有效的对象或字符串 var/www/html/laravel_test/vendor/zizaco/entrust/src/commands/MigrationCommand.php 在第86行

Class name must be a valid object or a string in var/www/html/laravel_test/vendor/zizaco/entrust/src/commands/MigrationCommand.php on line 86

MigrationCommand.php文件网址:链接

MigrationCommand.php file url : Link

输出:

php artisan entrust:migration

Tables: roles, role_user, permissions, permission_role
A migration that creates 'roles', 'role_user', 'permissions', 'permission_role' tables will be created in database/migrations directory

Proceed with the migration creation? [Yes|no] (yes/no) [yes]: yes

Creating migration...
PHP Fatal error:  Class name must be a valid object or a string in /var/www/html/laravel_test/vendor/zizaco/entrust/src/commands/MigrationCommand.php on line 86

命令: php artisan vendor:publish 成功.

文件:config/entrust.php存在.

File : config/entrust.php exist.

我没有更改与config/auth.php文件相同的任何选项-

I didin't change any options to config/auth.php file same as - auth.php. How to fix it?

推荐答案

在第86行的vendor/zizaco/entrust/src/commands/MigrationCommand.php中

in vendor/zizaco/entrust/src/commands/MigrationCommand.php on line 86

删除行:

    $usersTable  = Config::get('auth.table');
    $userModel   = Config::get('auth.model');

添加行:

$usersTable  = Config::get('auth.providers.users.table');
$userModel   = Config::get('auth.providers.users.model');

和config/auth.php文件像我一样写提供程序行:

and config/auth.php file write provider line as like me :

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\User::class,
        'table' => 'users',
    ],

    // 'users' => [
    //     'driver' => 'database',
    //     'table' => 'users',
    // ],
],

然后您的问题将解决:编码愉快

then your problem will solve : happy coding

这篇关于如何在laravel 5.2 zizaco entrust:migration类名验证中修复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆