Fix issue #5820

https://github.com/laravel/framework/issues/5820