add notes/remark and refactor round-trip
PHP Tests / php-tests (push) Has been cancelled

This commit is contained in:
Nyan Lin Paing
2026-08-22 21:43:41 +07:00
parent 894352b43f
commit fa908cdcaf
46 changed files with 1679 additions and 182 deletions
+12
View File
@@ -6,6 +6,7 @@ use App\Models\User;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Modules\Booking\Models\Booking;
use Modules\Payment\Database\Factories\RefundFactory;
use Modules\Payment\Enums\RefundStatus;
use Spatie\Activitylog\Models\Concerns\LogsActivity;
@@ -38,6 +39,7 @@ class Refund extends Model
*/
protected $fillable = [
'payment_id',
'booking_id',
'status',
'amount',
'reason',
@@ -67,6 +69,16 @@ class Refund extends Model
return $this->belongsTo(Payment::class);
}
/**
* The leg actually being refunded/cancelled not necessarily
* payment->booking, since a round trip's return leg refunds against the
* primary leg's shared Payment (domain.md §2b).
*/
public function booking(): BelongsTo
{
return $this->belongsTo(Booking::class);
}
public function requestedBy(): BelongsTo
{
return $this->belongsTo(User::class, 'requested_by');