Dashboard sipadu mbip
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

CompoundResource.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class CompoundResource extends JsonResource
  5. {
  6. /**
  7. * Transform the resource into an array.
  8. *
  9. * @param \Illuminate\Http\Request $request
  10. * @return array
  11. */
  12. public function toArray($request)
  13. {
  14. if($this->faulty != null && $this->staffdetail != null){
  15. return [
  16. '_id' => $this->_id,
  17. 'modul' => $this->modul,
  18. 'jenis' => $this->jenis,
  19. 'kpd' => $this->kpd,
  20. 'no_plate' => $this->no_plate,
  21. 'nric' => $this->identity,
  22. 'no_daftar_syarikat' => $this->no_daftar_syarikat,
  23. 'nama_syarikat' => $this->nama_syarikat,
  24. 'nama' => $this->nama,
  25. 'lesen' => $this->no_akaun_lesen,
  26. 'tarikh_masa' => $this->created_at->format('d/m/Y H:i:s A'),
  27. 'faulty_skter' => $this->faulty->sketr,
  28. 'faulty_name' => $this->faulty->nama,
  29. 'enforcer' => $this->staffdetail->no_badan.', '.$this->staffdetail->full_name,
  30. 'status' => $this->status,
  31. 'kadar_kompaun' => $this->jumlah_kemaskini_kompaun !== '' ? $this->jumlah_kemaskini_kompaun : $this->jumlah_asal_kompaun,
  32. 'catatan_dari_admin' => $this->catatan_dari_admin,
  33. 'updated_by' => $this->updateby,
  34. 'updates_by' => $this->update_by,
  35. 'tarikh_bayar' => $this->tarikh_bayar,
  36. 'amount_payment' => $this->amount_payment,
  37. 'created_at' => $this->created_at->format('Y-m-d H:i:s'),
  38. 'updated_at' => $this->updated_at->format('Y-m-d H:i'),
  39. ];
  40. }
  41. }
  42. }