PaymentGateway.php 758 B

123456789101112131415161718192021222324252627282930
  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', 'deleted_at'];
  10. protected $casts = [
  11. 'withdrawal_secret' => 'encrypted',
  12. 'recharge_channel_group_ids' => 'array',
  13. 'status' => 'integer',
  14. ];
  15. protected $appends = ['has_withdrawal_secret'];
  16. public function getHasWithdrawalSecretAttribute(): bool
  17. {
  18. return !empty($this->attributes['withdrawal_secret'] ?? null);
  19. }
  20. public function rechargeChannel()
  21. {
  22. return $this->belongsTo(RechargeChannel::class, 'recharge_channel_id');
  23. }
  24. }