PaymentGateway.php 977 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\SoftDeletes;
  4. class PaymentGateway extends BaseModel
  5. {
  6. use SoftDeletes;
  7. protected $table = 'payment_gateways';
  8. protected $guarded = [];
  9. protected $hidden = ['withdrawal_secret', 'deposit_secret', 'deleted_at'];
  10. protected $casts = [
  11. 'withdrawal_secret' => 'encrypted',
  12. 'deposit_secret' => 'encrypted',
  13. 'recharge_channel_group_ids' => 'array',
  14. 'status' => 'integer',
  15. ];
  16. protected $appends = ['has_withdrawal_secret', 'has_deposit_secret'];
  17. public function getHasDepositSecretAttribute(): bool
  18. {
  19. return !empty($this->attributes['deposit_secret'] ?? null);
  20. }
  21. public function getHasWithdrawalSecretAttribute(): bool
  22. {
  23. return !empty($this->attributes['withdrawal_secret'] ?? null);
  24. }
  25. public function rechargeChannel()
  26. {
  27. return $this->belongsTo(RechargeChannel::class, 'recharge_channel_id');
  28. }
  29. }