mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 04:23:59 +00:00
31 lines
916 B
PHP
31 lines
916 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Classes\ValueObjects\Constants\AccountStatus;
|
|
use App\Models\CompanyConnections;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class CompanyResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'account_no' => $this->reference_no,
|
|
'marking' => CompanyConnections::where('module_one', $this->modules->first()->id)->first()->marking,
|
|
'name' => $this->name,
|
|
'type' => $this->type,
|
|
'status' => AccountStatus::STATUS[$this->status],
|
|
'delivery_address' => new AddressResource($this->deliveryAddress),
|
|
'contact' => new ContactResource($this->contacts->first())
|
|
];
|
|
}
|
|
}
|