1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
-
- namespace App\Http\Resources;
-
- use Illuminate\Http\Resources\Json\JsonResource;
-
- class CompoundResource extends JsonResource
- {
- /**
- * Transform the resource into an array.
- *
- * @param \Illuminate\Http\Request $request
- * @return array
- */
- public function toArray($request)
- {
-
- if($this->faulty != null && $this->staffdetail != null){
-
- return [
- '_id' => $this->_id,
- 'modul' => $this->modul,
- 'jenis' => $this->jenis,
- 'kpd' => $this->kpd,
- 'no_plate' => $this->no_plate,
- 'nric' => $this->identity,
- 'no_daftar_syarikat' => $this->no_daftar_syarikat,
- 'nama_syarikat' => $this->nama_syarikat,
- 'nama' => $this->nama,
- 'lesen' => $this->no_akaun_lesen,
- 'tarikh_masa' => $this->created_at->format('d/m/Y H:i:s A'),
- 'faulty_skter' => $this->faulty->sketr,
- 'faulty_name' => $this->faulty->nama,
- 'enforcer' => $this->staffdetail->no_badan.', '.$this->staffdetail->full_name,
- 'status' => $this->status,
- 'kadar_kompaun' => $this->jumlah_kemaskini_kompaun !== '' ? $this->jumlah_kemaskini_kompaun : $this->jumlah_asal_kompaun,
- 'catatan_dari_admin' => $this->catatan_dari_admin,
- 'updated_by' => $this->updateby,
- 'updates_by' => $this->update_by,
- 'tarikh_bayar' => $this->tarikh_bayar,
- 'amount_payment' => $this->amount_payment,
- 'created_at' => $this->created_at->format('Y-m-d H:i:s'),
- 'updated_at' => $this->updated_at->format('Y-m-d H:i'),
- ];
- }
- }
- }
|