Laravel 4.2似乎无法读取软件包的配置文件

时间:2015-04-06 14:06:35

标签: php laravel-4

我在belongsToMany关系中收到此错误:

ErrorException (E_NOTICE)
HELP
Array to string conversion

我正在使用Entrust(https://github.com/Zizaco/entrust/tree/1.0)来获取我的用户角色和权限。当我做一个Config :: get('app.url')时,它返回一切正常。但是我注意到,委托中的配置是作为空白数组返回的,它不应该是。我的代码工作正常,直到我运行作曲家更新并且在Entrust中没有任何改变。

此代码特别返回空白数组:

php
$baseTable = $this->related->getTable();

它是Laravel中BelongsToMany.php文件中的第360行。 EntrustRole.php通过执行以下操作在构造函数中设置受保护的$ table属性:

php
$this->table = Config::get('entrust::roles_table');

在它的配置文件中,有:

php
<?php

return array(

    /*
    |--------------------------------------------------------------------------
    | Entrust Role Model
    |--------------------------------------------------------------------------
    |
    | This is the Role model used by Entrust to create correct relations.  Update
    | the role if it is in a different namespace.
    |
    */
    'role' => '\Role',

    /*
    |--------------------------------------------------------------------------
    | Entrust Roles Table
    |--------------------------------------------------------------------------
    |
    | This is the Roles table used by Entrust to save roles to the database.
    |
    */
    'roles_table' => 'roles',

    /*
    |--------------------------------------------------------------------------
    | Entrust Permission Model
    |--------------------------------------------------------------------------
    |
    | This is the Permission model used by Entrust to create correct relations.  Update
    | the permission if it is in a different namespace.
    |
    */
    'permission' => '\Permission',

    /*
    |--------------------------------------------------------------------------
    | Entrust Permissions Table
    |--------------------------------------------------------------------------
    |
    | This is the Permissions table used by Entrust to save permissions to the database.
    |
    */
    'permissions_table' => 'permissions',

    /*
    |--------------------------------------------------------------------------
    | Entrust permission_role Table
    |--------------------------------------------------------------------------
    |
    | This is the permission_role table used by Entrust to save relationship between permissions and roles to the database.
    |
    */
    'permission_role_table' => 'permission_role',

    /*
    |--------------------------------------------------------------------------
    | Entrust assigned_roles Table
    |--------------------------------------------------------------------------
    |
    | This is the assigned_roles table used by Entrust to save assigned roles to the database.
    |
    */
    'assigned_roles_table' => 'assigned_roles',

);

我在每个单独的键的构造函数中的EntrustRole.php中做了一个Config :: get('entrust :: key'),看看它是否只返回一个空白数组并返回一个空行数组。您可以在我之前发布的网址上看到Entrust的设置。

src
   config
      config.php
   Entrust
      EntrustRole.php
      AnotherClass.php
      etc...

这应该有用,我错了吗?

编辑: 以下是我的provider数组的外观:

'providers' => array(

        'Illuminate\Foundation\Providers\ArtisanServiceProvider',
        'Illuminate\Auth\AuthServiceProvider',
        'Illuminate\Cache\CacheServiceProvider',
        'Illuminate\Session\CommandsServiceProvider',
        'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
        'Illuminate\Routing\ControllerServiceProvider',
        'Illuminate\Cookie\CookieServiceProvider',
        'Illuminate\Database\DatabaseServiceProvider',
        'Illuminate\Encryption\EncryptionServiceProvider',
        'Illuminate\Filesystem\FilesystemServiceProvider',
        'Illuminate\Hashing\HashServiceProvider',
        'Illuminate\Html\HtmlServiceProvider',
        'Illuminate\Log\LogServiceProvider',
        'Illuminate\Mail\MailServiceProvider',
        'Illuminate\Database\MigrationServiceProvider',
        'Illuminate\Pagination\PaginationServiceProvider',
        'Illuminate\Queue\QueueServiceProvider',
        'Illuminate\Redis\RedisServiceProvider',
        'Illuminate\Remote\RemoteServiceProvider',
        'Illuminate\Auth\Reminders\ReminderServiceProvider',
        'Illuminate\Database\SeedServiceProvider',
        'Illuminate\Session\SessionServiceProvider',
        'Illuminate\Translation\TranslationServiceProvider',
        'Illuminate\Validation\ValidationServiceProvider',
        'Illuminate\View\ViewServiceProvider',
        'Illuminate\Workbench\WorkbenchServiceProvider',
        'Zizaco\Entrust\EntrustServiceProvider',
        'TwigBridge\ServiceProvider',
        'Mews\Purifier\PurifierServiceProvider',
        'Intellectproductions\Asset\AssetServiceProvider',
        'Intellectproductions\Verify\VerifyServiceProvider',
        'Barryvdh\Debugbar\ServiceProvider',
        'Intervention\Image\ImageServiceProvider',
        'Intellectproductions\Exemplary\ExemplaryServiceProvider',
        'Bunny\Providers\BunnyServiceProvider',
        'Bunny\Providers\UserServiceProvider',
        'Bunny\Providers\BreedServiceProvider',
        'Bunny\Providers\UserPetServiceProvider',
        'Bunny\Providers\ForumServiceProvider',
        'Bunny\Providers\RandomEventServiceProvider',
        'Bunny\Providers\TutorialServiceProvider'
    ),

我不得不把Entrust放在我的UserServiceProvider之前我相信..但重新组织它就像修复了这个问题。我不知道是不是因为我的供应商(Bunny \ Providers)依赖于我安装的软件包..但希望这有助于其他人。我觉得这有点傻,但是哦,好吧!

0 个答案:

没有答案