【发布时间】:2014-04-24 11:08:19
【问题描述】:
我正在创建自己的包,我只想使用与应用程序身份验证表不同的表为我的包添加身份验证。
我找不到仅为我的包覆盖应用程序auth.table 配置的方法。
搜索我找到了this solution,它可以即时更改配置。
在我的代码中:
class EasytranslateServiceProvider extends ServiceProvider {
[...]
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->package('revolistic/easytranslate');
// add the packages routes
include __DIR__.'/../../routes.php';
// doesn't work
$this->app['config']['auth'] = \Config::get('easytranslate::auth');
}
[...]
}
但是不起作用,看起来Auth模块在创建包或boot()函数调用之前正在读取配置。
如果我这样做:
class EasytranslateServiceProvider extends ServiceProvider {
[...]
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->package('revolistic/easytranslate');
// add the packages routes
include __DIR__.'/../../routes.php';
// doesn't work
$this->app['config']['auth'] = \Config::get('easytranslate::auth');
// show that the changes was made
print_r($this->app['config']['auth']);
}
[...]
}
我知道配置已更改,但 Auth 模型仍在使用应用程序身份验证配置文件中的表名。
我正在使用最新版本的 Laravel,知道如何完成它吗?
提前致谢
【问题讨论】:
标签: authentication laravel laravel-4 package config