update list all customer transactions

This commit is contained in:
edmondlang
2023-06-29 22:00:26 +08:00
parent ed0bcb34c4
commit a90c79396b
3 changed files with 20 additions and 6 deletions
@@ -5,6 +5,7 @@ namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Booking;
use Carbon\Carbon;
use App\Models\Wallet;
use Illuminate\Http\Resources\Json\JsonResource;
class PaymentTransactionResource extends JsonResource
@@ -20,9 +21,19 @@ class PaymentTransactionResource extends JsonResource
$booking = in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])? $this->owner->owner : $this->owner;
$booking_marking = '';
switch ($this->owner_type) {
case Booking::class:
$booking_marking = $booking->marking;
break;
case Wallet::class:
$booking_marking = $this->booking->marking;
break;
}
return [
'id' => $this->id,
'booking_marking' => $booking->marking,
'booking_marking' => $booking_marking,
'type' => (int) $this->type,
'bill_no' => $this->bill_no,
'payment_reference' => $this->payment_reference,