Created
May 31, 2017 11:32
-
-
Save PoTHuYJoHN/3b1e222b36cd918bd944981d84e93d45 to your computer and use it in GitHub Desktop.
Trial time with Carbon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ServicePackageRepository | |
{ | |
/** | |
* @return int | |
*/ | |
public function getTrialDaysCount() | |
{ | |
$cDate = Carbon::parse(self::TRIAL_DUE_FOR_STANDARD_PLAN); | |
return $cDate->diffInDays(Carbon::today()->setTime(17,0,0)) + 1; | |
} | |
/** | |
* @param string $planName | |
* @return bool | |
*/ | |
public function canUseTrial(string $planName) | |
{ | |
return $planName === self::STANDARD_PLAN_NAME | |
&& Carbon::now()->lt(Carbon::parse(self::TRIAL_DUE_FOR_STANDARD_PLAN)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment