mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
E-Invoice - Initial commit main feature integration
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class AddressEInvoiceResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'street_one' => $this->street_one,
|
||||
'street_two' => $this->street_two,
|
||||
'district' => $this->district,
|
||||
'state' => $this->state,
|
||||
'post_code' => (int) $this->postcode,
|
||||
'country' => $this->country,
|
||||
'billing' => (int) $this->billing
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -54,8 +54,7 @@ class CompanyModuleResource extends JsonResource
|
||||
'e_invoice' => $this->company->e_invoice,
|
||||
'tin' => $this->company->tin,
|
||||
'msic_code' => $this->company->msic_code,
|
||||
'address_einvoice' => $this->company->e_invoice ? new AddressResource($this->when($this->has('addresses'), $this->addresses->where('type', AddressType::E_INVOICE)->sortByDesc('created_at')->first())) : null,
|
||||
|
||||
'address_einvoice' => $this->company->e_invoice ? new AddressEInvoiceResource($this->when($this->has('addresses'), $this->addresses->where('type', AddressType::E_INVOICE)->sortByDesc('created_at')->first())) : null,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class EInvoiceInfoResource extends JsonResource
|
||||
'street_two' => $this->street_two,
|
||||
'district' => $this->district,
|
||||
'state' => $this->state,
|
||||
'post_code' => $this->postcode,
|
||||
'post_code' => (int) $this->postcode,
|
||||
'country' => $this->country,
|
||||
'billing' => (int) $this->billing,
|
||||
'msic_code' => (int) $this->msic_code,
|
||||
|
||||
Reference in New Issue
Block a user