pRieStaKos Posted January 21, 2021 Share Posted January 21, 2021 Hello, I'm creating a module cronjon and I want to create a CarbonPeriod, but when I'm using `Carbon\CarbonPeriod` it returns the following error, every time I run the cronjob. Trait 'Carbon\Traits\IntervalRounding' not found I downloaded CarbonPeriod.php from Carbon GitHub and uploaded to `vendor/nesbot/carbon/src/Carbon/ ` I tried use Carbon\Carbon; use Carbon\CarbonPeriod; and use WHMCS\Carbon\Carbon; use WHMCS\Carbon\CarbonPeriod; without any luck. Any suggestions ? I want to check if a create period `CarbonPeriod::create($service->regdate, '1 month', $service->nextduedate);` contains `Carbon::now()` Thank you in advance. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted January 21, 2021 Share Posted January 21, 2021 You mentioned you downloaded CarbonPeriod.php but the trait it complains about isn't in that file but rather it is in Carbon/Traits/IntervalRounding.php . And that file appears to be missing from the WHMCS copy of Carbon. So download that one as well as any others that it may require. Replacing the WHMCS copy with the github version might be better. 1 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted January 22, 2021 Author Share Posted January 22, 2021 11 hours ago, steven99 said: You mentioned you downloaded CarbonPeriod.php but the trait it complains about isn't in that file but rather it is in Carbon/Traits/IntervalRounding.php . And that file appears to be missing from the WHMCS copy of Carbon. So download that one as well as any others that it may require. Replacing the WHMCS copy with the github version might be better. Kudos @steven99. I was looking for a light version on resolving that, but uploading the latest zip from GitHub and using the following, worked !! use WHMCS\Carbon; use Carbon\CarbonPeriod; Thank you. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.