mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-23 14:33:59 +00:00
Quick fix to show latest ssm document uploaded by user - issue reported by Sin Yee
This commit is contained in:
@@ -43,7 +43,7 @@ class CompanyResource extends JsonResource
|
||||
'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())),
|
||||
'address' => new AddressResource($this->when($this->has('addresses'), $this->addresses->where('billing', true)->first())),
|
||||
'employee' => new UserResource(Auth::user()->type === RoleTypes::USER ? $this->employees()->where('email', '=', Auth::user()->email)->first() : $this->employees()->orderBy('id', 'DESC')->first()),
|
||||
'identification' => new DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->first()),
|
||||
'identification' => new DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->sortByDesc('created_at')->first()),
|
||||
'bookings' => $this->whenLoaded('bookings', $this->bookings()->orderBy('id', 'DESC')->get(), []),
|
||||
'confirmed_bookings' => $this->bookings()->whereHas('transactions', function ($query){
|
||||
$query->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
|
||||
@@ -61,7 +61,7 @@ class CompanyV2Resource extends JsonResource
|
||||
'contact' => new V1\ContactResource ($this->when($this->has('contacts'), $this->contacts->first())),
|
||||
'address' => new V1\AddressResource($this->when($this->has('addresses'), $this->addresses->where('billing', true)->first())),
|
||||
'employee' => $userResource,
|
||||
'identification' => new V1\DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->first()),
|
||||
'identification' => new V1\DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->sortByDesc('created_at')->first()),
|
||||
'bookings' => $this->whenLoaded('bookings', $this->bookings()->orderBy('id', 'DESC')->get(), []),
|
||||
'confirmed_bookings' => $this->bookings()->whereHas('transactions', function ($query){
|
||||
$query->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
|
||||
Reference in New Issue
Block a user