【发布时间】:2015-09-03 18:29:45
【问题描述】:
我正在 laravel 5.1 上启动一个包。到目前为止使用 laravel 4.2
我已经能够在服务提供商的boot 方法中为我的包发布包配置文件,如文档中所述:
public function boot()
{
$this->publishes([
__DIR__ . '/config/config.php' => config_path('/packages/longestdrive/googlecal/googlecal.php'),
]);
现在我正在尝试使用以下方式访问此配置中的项目:
config('googlecal.client_id');
然而这会返回null
如果我只是这样做:config() 我会得到一个完整的配置数组数组,并且可以在那里看到我的包配置文件。
如果我这样做:config('longestdrive.googlecal.googlecal.client_id') 我可以访问该变量。
在 L4.2 中,我不需要有效地添加变量的完整路径。
我是否错过了一些让我可以简单做的事情:config('googlecal.client_id')
谢谢
【问题讨论】: