| Total Complexity | 6 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Transfer extends Model |
||
| 11 | { |
||
| 12 | public const ACTION_TRANSFER = 'transfer'; |
||
| 13 | public const ACTION_READ = 'read'; |
||
| 14 | public const ACTION_DOWNLOAD = 'download'; |
||
| 15 | public const ACTION_SUBSCRIBE = 'subscribe'; |
||
| 16 | public const ACTION_TRIAL = 'trial'; |
||
| 17 | public const ACTION_PAID = 'paid'; |
||
| 18 | public const ACTION_REFUND = 'refund'; |
||
| 19 | public const ACTION_GIFT = 'gift'; |
||
| 20 | |||
| 21 | protected $fillable = [ |
||
| 22 | 'deposit_id', |
||
| 23 | 'withdraw_id', |
||
| 24 | 'from_type', |
||
| 25 | 'from_id', |
||
| 26 | 'from_wallet_id', |
||
| 27 | 'to_type', |
||
| 28 | 'to_id', |
||
| 29 | 'to_wallet_id', |
||
| 30 | 'action', |
||
| 31 | 'uuid', |
||
| 32 | 'fee', |
||
| 33 | 'refund' |
||
| 34 | ]; |
||
| 35 | |||
| 36 | protected $casts = [ |
||
| 37 | 'refund' => 'boolean' |
||
| 38 | ]; |
||
| 39 | |||
| 40 | 1 | public function from(): MorphTo |
|
| 41 | { |
||
| 42 | 1 | return $this->morphTo(); |
|
| 43 | } |
||
| 44 | |||
| 45 | 2 | public function fromWallet(): BelongsTo |
|
| 46 | { |
||
| 47 | 2 | return $this->belongsTo(Wallet::class); |
|
| 48 | } |
||
| 49 | |||
| 50 | 1 | public function to(): MorphTo |
|
| 51 | { |
||
| 52 | 1 | return $this->morphTo(); |
|
| 53 | } |
||
| 54 | |||
| 55 | 2 | public function toWallet(): BelongsTo |
|
| 56 | { |
||
| 57 | 2 | return $this->belongsTo(Wallet::class); |
|
| 58 | } |
||
| 59 | |||
| 60 | 2 | public function deposit(): BelongsTo |
|
| 61 | { |
||
| 62 | 2 | return $this->belongsTo(Transaction::class, 'deposit_id'); |
|
| 63 | } |
||
| 64 | |||
| 65 | 2 | public function withdraw(): BelongsTo |
|
| 68 | } |
||
| 69 | } |
||
| 70 |