mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-19 04:24:00 +00:00
30 lines
745 B
PHP
30 lines
745 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class Contact extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
$comapny = \App\Models\Company::findOrFail($this->reference_id);
|
|
return [
|
|
'id' => $this->id,
|
|
'type' => $this->type,
|
|
'reference_id' => $this->reference_id,
|
|
'name' => $this->name,
|
|
'designation' => $this->designation,
|
|
'contact' => $this->contact,
|
|
'email' => $this->email,
|
|
'company' => Company::make($comapny)
|
|
];
|
|
}
|
|
}
|