mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 20:43:56 +00:00
61 lines
2.0 KiB
PHP
61 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Classes\ValueObjects\Constants\StatementTransactionOwnerType;
|
|
use App\Models\Booking;
|
|
use App\Models\Group;
|
|
use App\Models\Transaction;
|
|
use App\Models\Wallet;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class BankStatementTransactionOwnerResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
|
|
$referenceLink = null;
|
|
if($this->system === 'EXCHANGE') {
|
|
if($this->owner_type === Transaction::class){
|
|
if($this->type === StatementTransactionOwnerType::SALES){
|
|
$referenceLink = route('booking.details', $this->owner_reference);
|
|
}
|
|
|
|
if($this->type === StatementTransactionOwnerType::WALLET_TOP_UP){
|
|
$referenceLink = route('wallet.details', $this->owner_reference);
|
|
}
|
|
}
|
|
}
|
|
|
|
if($this->system === 'SHIPPING_PORTAL') {
|
|
if($this->owner_type === Transaction::class){
|
|
if($this->type === StatementTransactionOwnerType::SALES){
|
|
$referenceLink = 'https://izyim.cief-malaysia.com/order/show/'. $this->owner_reference;
|
|
}
|
|
if($this->type === StatementTransactionOwnerType::WALLET_TOP_UP){
|
|
$referenceLink = 'https://izyim.cief-malaysia.com/wallet/'. $this->owner_reference .'/details';
|
|
}
|
|
}
|
|
}
|
|
|
|
return [
|
|
'id' => $this->id,
|
|
'type' => $this->type,
|
|
'system' => $this->system,
|
|
'owner_type' => $this->owner_type,
|
|
'owner_id' => $this->owner_id,
|
|
'reference' => $this->owner_reference,
|
|
'reference_link' => $referenceLink,
|
|
'invoice_reference' => $this->invoice_reference,
|
|
'receipt_reference' => $this->receipt_reference,
|
|
'status' => $this->status
|
|
];
|
|
}
|
|
}
|