Laravel - 服务器无法设置缓存

时间:2015-12-18 20:38:35

标签: php laravel laravel-5.1

我目前在我的settings表中设置了很多设置,在我的本地服务器上一切都很好,但问题出在在线环境中,我不知道是否需要配置任何东西,但它没有设置缓存,它可以是什么?

class SettingsServiceProvider extends ServiceProvider
{
    public function boot(Factory $cache, SettingRepository $settings)
    {
        if(Schema::hasTable('settings')){
            $settings = $cache->remember('settings', 60, function() use ($settings)
            {
                return $settings->lists();
            });
            config()->set('settings', $settings);
        }
    }
    public function register()
    {
        $this->app->bind(
            \App\Repositories\SettingRepository::class
        );
    }
}

1 个答案:

答案 0 :(得分:0)

composer clear-cache&& composer dump-autoload解决了问题