laravel-websockets icon indicating copy to clipboard operation
laravel-websockets copied to clipboard

fix: Account for CarbonImmutable used in Laravel projects in CleanStatistics command

Open kondratovbr opened this issue 2 years ago • 0 comments

Laravel projects can easily be globally configured to use CarbonImmutable objects instead of normal mutable ones.

Projects like this cause an exception when running CleanStatistics command:

BeyondCode\LaravelWebSockets\Statistics\Stores\DatabaseStore::delete():
Argument #1 ($moment) must be of type Carbon\Carbon, Carbon\CarbonImmutable given, called in
/home/app/michman/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 337

Proper fix would be to declare Carbon instances in StatisticsStore interface as CarbonInterface, but this would break the existing stores, so this PR suggests a slightly dirty fix to this issue.

kondratovbr avatar Jul 29 '22 20:07 kondratovbr