Changeset View
Changeset View
Standalone View
Standalone View
src/app/Transaction.php
<?php | <?php | ||||
namespace App; | namespace App; | ||||
use App\Entitlement; | |||||
use App\Wallet; | |||||
use App\Traits\UuidStrKeyTrait; | use App\Traits\UuidStrKeyTrait; | ||||
use Illuminate\Database\Eloquent\Model; | use Illuminate\Database\Eloquent\Model; | ||||
/** | /** | ||||
* The eloquent definition of a Transaction. | * The eloquent definition of a Transaction. | ||||
* | * | ||||
* @property int $amount | * @property int $amount | ||||
* @property string $description | * @property string $description | ||||
Show All 14 Lines | class Transaction extends Model | ||||
public const WALLET_AWARD = 'award'; | public const WALLET_AWARD = 'award'; | ||||
public const WALLET_CREDIT = 'credit'; | public const WALLET_CREDIT = 'credit'; | ||||
public const WALLET_DEBIT = 'debit'; | public const WALLET_DEBIT = 'debit'; | ||||
public const WALLET_PENALTY = 'penalty'; | public const WALLET_PENALTY = 'penalty'; | ||||
public const WALLET_REFUND = 'refund'; | public const WALLET_REFUND = 'refund'; | ||||
public const WALLET_CHARGEBACK = 'chback'; | public const WALLET_CHARGEBACK = 'chback'; | ||||
/** @var array<int, string> The attributes that are mass assignable */ | |||||
protected $fillable = [ | protected $fillable = [ | ||||
// actor, if any | // actor, if any | ||||
'user_email', | 'user_email', | ||||
// entitlement, wallet | // entitlement, wallet | ||||
'object_id', | 'object_id', | ||||
'object_type', | 'object_type', | ||||
// entitlement: created, deleted, billed | // entitlement: created, deleted, billed | ||||
// wallet: debit, credit, award, penalty | // wallet: debit, credit, award, penalty | ||||
'type', | 'type', | ||||
'amount', | 'amount', | ||||
'description', | 'description', | ||||
// parent, for example wallet debit is parent for entitlements charged. | // parent, for example wallet debit is parent for entitlements charged. | ||||
'transaction_id' | 'transaction_id' | ||||
]; | ]; | ||||
/** @var array Casts properties as type */ | /** @var array<string, string> Casts properties as type */ | ||||
protected $casts = [ | protected $casts = [ | ||||
'amount' => 'integer', | 'amount' => 'integer', | ||||
]; | ]; | ||||
/** | /** | ||||
* Returns the entitlement to which the transaction is assigned (if any) | * Returns the entitlement to which the transaction is assigned (if any) | ||||
* | * | ||||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |