Fix determining traffic usage month end
This commit is contained in:
@@ -23,6 +23,10 @@ class AdslTraffic extends Model
|
||||
|
||||
public function getTrafficMonthEndAttribute() {
|
||||
if ($this->date->day > $this->traffic_end) {
|
||||
// If we are the last day of the month, we'll temporarily take 3 days since Jan 31 and addMonth() results in March.
|
||||
if ($this->date->isLastOfMonth())
|
||||
$this->date=$this->date->subDays(3);
|
||||
|
||||
return Carbon::createFromFormat('Y-m-d',$this->date->addMonth()->format('Y-m-').$this->traffic_end);
|
||||
} else {
|
||||
return Carbon::createFromFormat('Y-m-d',$this->date->format('Y-m-').$this->traffic_end);
|
||||
|
Reference in New Issue
Block a user