Total Complexity | 6 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 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 | public const ACTION_EXCHANGE = 'exchange'; |
||
21 | |||
22 | protected $fillable = [ |
||
23 | 'deposit_id', |
||
24 | 'withdraw_id', |
||
25 | 'from_type', |
||
26 | 'from_id', |
||
27 | 'from_wallet_id', |
||
28 | 'to_type', |
||
29 | 'to_id', |
||
30 | 'to_wallet_id', |
||
31 | 'action', |
||
32 | 'uuid', |
||
33 | 'fee', |
||
34 | 'refund' |
||
35 | ]; |
||
36 | |||
37 | protected $casts = [ |
||
38 | 'refund' => 'boolean' |
||
39 | ]; |
||
40 | |||
41 | 1 | public function from(): MorphTo |
|
42 | { |
||
43 | 1 | return $this->morphTo(); |
|
44 | } |
||
45 | |||
46 | 4 | public function fromWallet(): BelongsTo |
|
47 | { |
||
48 | 4 | return $this->belongsTo(Wallet::class); |
|
49 | } |
||
50 | |||
51 | 1 | public function to(): MorphTo |
|
52 | { |
||
53 | 1 | return $this->morphTo(); |
|
54 | } |
||
55 | |||
56 | 4 | public function toWallet(): BelongsTo |
|
57 | { |
||
58 | 4 | return $this->belongsTo(Wallet::class); |
|
59 | } |
||
60 | |||
61 | 2 | public function deposit(): BelongsTo |
|
62 | { |
||
63 | 2 | return $this->belongsTo(Transaction::class, 'deposit_id'); |
|
64 | } |
||
65 | |||
66 | 2 | public function withdraw(): BelongsTo |
|
69 | } |
||
70 | } |
||
71 |