'integer', 'out_id2' => 'integer', 'out_id3' => 'integer', 'currency_id' => 'integer', 'fund_id' => 'integer', 'fund_to_uid' => 'integer', 'fund_in_uid' => 'integer', 'exchange_rate' => 'decimal:4', 'is_enabled' => 'boolean', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', ]; /** * 软删除 */ protected $dates = ['deleted_at']; /** * 隐藏字段 */ protected $hidden = []; /** * 关联划转订单 */ public function orders() { return $this->hasMany(TransferOrder::class, 'transfer_app_id'); } /** * 获取启用状态文本 */ public function getEnabledTextAttribute(): string { return $this->is_enabled ? '启用' : '禁用'; } /** * 获取启用状态颜色 */ public function getEnabledColorAttribute(): string { return $this->is_enabled ? 'success' : 'danger'; } /** * 判断是否为农场内部模式 */ public function isInternalMode(): bool { return empty($this->order_callback_url) && empty($this->order_in_info_url) && empty($this->order_out_create_url) && empty($this->order_out_info_url); } /** * 判断是否支持转入 */ public function supportsTransferIn(): bool { return !empty($this->order_in_info_url) || $this->isInternalMode(); } /** * 判断是否支持转出 */ public function supportsTransferOut(): bool { return !empty($this->order_out_create_url) || $this->isInternalMode(); } /** * 判断是否支持回调 */ public function supportsCallback(): bool { return !empty($this->order_callback_url); } }