Changeset View
Changeset View
Standalone View
Standalone View
src/app/Observers/EntitlementObserver.php
<?php | <?php | ||||
namespace App\Observers; | namespace App\Observers; | ||||
use App\Entitlement; | use App\Entitlement; | ||||
use Carbon\Carbon; | |||||
/** | /** | ||||
* This is an observer for the Entitlement model definition. | * This is an observer for the Entitlement model definition. | ||||
*/ | */ | ||||
class EntitlementObserver | class EntitlementObserver | ||||
{ | { | ||||
/** | /** | ||||
* Handle the "creating" event on an Entitlement. | * Handle the "creating" event on an Entitlement. | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | public function creating(Entitlement $entitlement) | ||||
return false; | return false; | ||||
} | } | ||||
$result = $sku->handler_class::preReq($entitlement, $owner); | $result = $sku->handler_class::preReq($entitlement, $owner); | ||||
if (!$result) { | if (!$result) { | ||||
return false; | return false; | ||||
} | } | ||||
// TODO: Handle the first free unit here? | |||||
// TODO: Execute the Sku handler class or function? | |||||
$wallet->debit($sku->cost); | |||||
} | } | ||||
} | } |