grohiro / laravel-camelcase-json

Convert response JSON key to camelCase
MIT License
27 stars 4 forks source link

Module craches artisan if you use session driver redis #4

Open d0cm0d opened 6 years ago

d0cm0d commented 6 years ago

This module craches artisan if you use session driver redis.

If you change public function register() to public function boot() in CamelCaseJsonResponseServiceProvider.php, the bug is fixed.

d0cm0d commented 6 years ago

I noticed, that the above doesn't fix the bug. Artisan is working again, but the Camelcase provider is not. Instead you have to fix the class like the following:

` class CamelCaseJsonResponseServiceProvider extends ServiceProvider {

public function register() {
    $this->app->singleton(ResponseFactory::class, function() {
        $view = $this->app->make('view');
        $redirect = $this->app->make('redirect');
        return new CamelCaseJsonResponseFactory($view, $redirect);
    });
}

} `