database-pertani-web/app/Http/Resources/Wilayah/DesaKelurahanResource.php

25 lines
570 B
PHP

<?php
namespace App\Http\Resources\Wilayah;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class DesaKelurahanResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'nama' => $this->nama,
'kode' => $this->kode,
'kecamatan' => $this->kecamatan ? new KecamatanResource($this->kecamatan) : null,
];
}
}