<?php namespace World;
use Illuminate\Support\ServiceProvider;
class TMissionServiceProvider extends ServiceProvider {
protected $defer = false;
public function register()
{
$this->app['mission'] = $this->app->share(function($app)
{
# $config = How to array of package config?
return new Mission($config);
});
}
public function boot()
{
$this->package(null, 'mission', realpath(__DIR__. '/../'));
}
public function provides()
{
return array('mission');
}
}
如何从我的 ? 中获取返回的数组mission/config.php
?
<?php
return array(
'host' => '127.0.0.1',
'leader' => 'Mother Theresa'
);
当我这样做时,它会返回正确的值
dd($app['config']->get('mission::host')); # 127.0.0.1
但是当我这样做时
dd($app['config']->get('mission')); # array() empty
它返回一个空数组。