| Total Complexity | 4 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class Transaction extends Model |
||
| 11 | { |
||
| 12 | public const TYPE_DEPOSIT = 'deposit'; |
||
| 13 | public const TYPE_WITHDRAW = 'withdraw'; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var array |
||
| 17 | */ |
||
| 18 | protected $fillable = [ |
||
| 19 | 'holder_type', |
||
| 20 | 'holder_id', |
||
| 21 | 'wallet_id', |
||
| 22 | 'uuid', |
||
| 23 | 'type', |
||
| 24 | 'amount', |
||
| 25 | 'confirmed', |
||
| 26 | 'meta', |
||
| 27 | ]; |
||
| 28 | |||
| 29 | protected $casts = [ |
||
| 30 | 'amount' => 'int', |
||
| 31 | 'confirmed' => 'bool', |
||
| 32 | 'meta' => 'json' |
||
| 33 | ]; |
||
| 34 | |||
| 35 | 1 | public function holder(): MorphTo |
|
| 36 | { |
||
| 37 | 1 | return $this->morphTo(); |
|
| 38 | } |
||
| 39 | |||
| 40 | 1 | public function wallet(): BelongsTo |
|
| 41 | { |
||
| 42 | 1 | return $this->belongsTo(Wallet::class); |
|
| 43 | } |
||
| 44 | |||
| 45 | 1 | public function scopeDeposit($query) |
|
| 48 | } |
||
| 49 | |||
| 50 | 1 | public function scopeWithdraw($query) |
|
| 53 | } |
||
| 54 | } |
||
| 55 |