Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/EntitlementObserver.php
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | public function deleting(Entitlement $entitlement) | ||||
// | // | ||||
// Effect is that anything's free for the first 14 days | // Effect is that anything's free for the first 14 days | ||||
if ($entitlement->created_at >= Carbon::now()->subDays(14)) { | if ($entitlement->created_at >= Carbon::now()->subDays(14)) { | ||||
return; | return; | ||||
} | } | ||||
$owner = $entitlement->wallet->owner; | $owner = $entitlement->wallet->owner; | ||||
if ($owner->isDegraded()) { | |||||
return; | |||||
} | |||||
// Determine if we're still within the free first month | // Determine if we're still within the free first month | ||||
$freeMonthEnds = $owner->created_at->copy()->addMonthsWithoutOverflow(1); | $freeMonthEnds = $owner->created_at->copy()->addMonthsWithoutOverflow(1); | ||||
if ($freeMonthEnds >= Carbon::now()) { | if ($freeMonthEnds >= Carbon::now()) { | ||||
return; | return; | ||||
} | } | ||||
$now = Carbon::now(); | $now = Carbon::now(); | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |